Insecure JSON Web Token
- OWASP 2025-A07
A JSON Web Token (JWT) is a signed, URL safe container for claims such as the user's identity and roles. Servers hand it out after login and accept it back as proof of who the caller is, so a weakness in the token or in the way it is issued translates directly into account takeover or privilege escalation.
Rapplex finds tokens in responses, request headers, cookies and URLs and examines each one without sending any additional request. The checks cover the signature algorithm, guessable signing secrets, expiration, secrets inside the payload, header parameters that let the sender choose the verification key, and how the token is transported.
A token's payload is only base64url encoded, not encrypted. Everyone who can see the token can read every claim in it.
Remediation
Always sign, always verify. Verify the signature and reject tokens that are unsigned or that use the
nonealgorithm. Configure the verifier with an allow-list of algorithms instead of trusting thealgheader of the token.Use strong keys. Prefer asymmetric algorithms (RS256, ES256, EdDSA). When an HMAC algorithm is required, use a random secret of at least 256 bits that is stored in a secret manager and rotated.
Keep tokens short lived. Always set
exp, keep access tokens to minutes and use refresh tokens with rotation for longer sessions.Keep the payload minimal. Do not put passwords, keys or personal data into a token. Use an encrypted token (JWE) or a reference token when the content must stay private.
Do not trust header supplied keys. Ignore
jku,x5uandjwkunless they match a fixed allow-list, and sanitizekidbefore it is used in a lookup.Transport the token safely. Send it only over HTTPS, in the
Authorizationheader or in aSecure,HttpOnly,SameSitecookie, never in a URL.
References
Search Vulnerability
You may also see
- Insecure JSON Web Token (Unsigned)
- Insecure JSON Web Token (Weak Signing Secret)
- Insecure JSON Web Token (Missing Expiration)
- Insecure JSON Web Token (Excessive Lifetime)
- Insecure JSON Web Token (Sensitive Claims)
- Insecure JSON Web Token (Untrusted Key Reference)
- Insecure JSON Web Token (Exposed in URL)
- Insecure JSON Web Token (Cleartext Transmission)
- Insecure JSON Web Token
- Insecure Session Management