Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe token validation #86

Open
revilwang opened this issue Oct 8, 2019 · 1 comment
Open

Unsafe token validation #86

revilwang opened this issue Oct 8, 2019 · 1 comment

Comments

@revilwang
Copy link

revilwang commented Oct 8, 2019

According to Validating a JWT,

there is a risk of algorithm substitution
attacks, in which an attacker can use an existing digital signature
value with a different signature algorithm to make it appear that a
signer has signed something that it has not

But no algorithm configuration found. The jsonwebtoken has an example to validate against the algorithm.

// alg mismatch
var cert = fs.readFileSync('public.pem'); // get public key
jwt.verify(token, cert, { algorithms: ['RS256'] }, function (err, payload) {
  // if token alg != RS256,  err == invalid signature
});

Hope this is supported.

@julianlam
Copy link
Owner

We use the jsonwebtoken package quite transparently, so yes, this is possible. Just a thought, though... in that if you were to substitute a different signature, wouldn't you still have to know the secret to do so?

Nevertheless, I'll add in the option to specify allowed algorithms in the ACP (defaulting to... either all of them, or HS256)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants