2

I was reading this article and it says that there might be some vulnerabilites with JWT.

From the article:

There were two ways to attack a standards-compliant JWS library to achieve trivial token forgery:

  1. Send a header that specifies the "none" algorithm be used
  2. Send a header that specifies the "HS256" algorithm when the application normally signs messages with an RSA public key.

But in order to send this headers, wouldn't the attacker need to have access to the secret?

1
  • It is an implementation error, not JWT itself. You need to test the implementation you are using on these two cases. If you manage to explot it, change the implementation (library) and try again until you find one which is not voulnerable. JWT is secure to be used as session id as long as implementation is not voulnerable. Mar 18, 2017 at 18:59

1 Answer 1

3

A JWT consists of three parts. The header, the payload and the signature. The header specifies which signature method is used, so it the signature can not be verified before reading the header. Note that this is an implementation error; the header should not be able to change the signature algorithm.

Send a header that specifies the "none" algorithm be used

In this case there is no signature, so the attacker can modify the message at will.

Send a header that specifies the "HS256" algorithm when the application normally signs messages with an RSA public key.

In this case the attacker needs to know the secret. However, RS256 uses asymetric cryptography, in which the public key is often published. If the attacker succeeds in changing this to HS256, the public key is used as symmetric key instead. So the attacker knows the secret because it is the public key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .