JWT attacks
Last updated
Last updated
JSON Web Token is a proposed Internet standard for creating data with optional signature and/or optional encryption whose payload holds JSON that asserts some number of claims. The tokens are signed either using a private secret or a public/private key.
--
Signature is not verified
Accepting tokens w/o signature
Sometimes developers don't change default keys or use keys from code snippets copied from the internet. A comprehensive list of such keys can be found here: .
If the app supports one of the following (optional) JWT header parameters, you may be able to use your own key for signature validation instead of the server one.
jwk
(JSON Web Key): Embedded key
jku
(JSON Web Key Set URL): URL, to fetch the key from
kid
(Key ID): Specify the key (via ID), if multiple keys are available
JWT Editor Keys: Generate new RSA key
Burp Repeater: Modify token
"Attack", use "Embedded JWK"
Select generated key (from above)
Generate a new key (e.g. using Burp Suite -> JWT Editor Keys).
Host that key in a json file somewhere.
Reference it in JWT header.
Modify and sign the token.
If the kid
parameter is vulnerable to directory traversal, using /dev/null
(present on most linux systems) and then also signing the JWT with a null-byte leads to a valid signature.
Key used for signature (AA==
is a base64 encoded null-byte):
JWT header:
See .