Skip to content
New issue

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

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

Already on GitHub? # to your account

Bug report: JWT Verify doesn't require an algorithm #624

Open
joshbarth opened this issue Aug 27, 2019 · 3 comments
Open

Bug report: JWT Verify doesn't require an algorithm #624

joshbarth opened this issue Aug 27, 2019 · 3 comments

Comments

@joshbarth
Copy link

As detailed here, JWT verification functions should require specifying the algorithm that should have been used, in order to prevent an attacker from changing the algorithm to a symmetric algorithm from an asymmetric one and using the public key to sign the token. Probably low priority for this particular app, but it would be good to at least have the option.

@mifriis
Copy link

mifriis commented Aug 29, 2019

Hi @joshbarth,
Correct me if i am wrong or misunderstand you, but isn't the problem you link to, a serverside issue where developers simply trust whatever signing alg the token specifies? Removing the "none" signing alg from Cyberchef won't help the problem. Servers need to interpret the tokens with the signing alg it writes the tokens with.

Having the "none" signing alg there is a great tool for testing your implementation of JWT verification, to catch the problems mentioned in the link.

@joshbarth
Copy link
Author

I don't mean removing the none algorithm, I meaning allowing the user to specify which algorithm is expected and raise an error if the jwt defines it differently. The relevant part of the article is this: https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/#RSA-or-HMAC-. Specifically "If a server is expecting a token signed with RSA, but actually receives a token signed with HMAC, it will think the public key is actually an HMAC secret key." Basically, the solution is, rather than trusting the jwt alg field, allowing the user to define the algorithm. Hope that makes more sense.

@ghost
Copy link

ghost commented Jun 24, 2020

Yeah, that would be good especially since the JWT header isn't shown at all. I recommend using https://jwt.io/ for playing with JWT tokens.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants