JWT Security Vulnerabilities
Every significant class of JWT vulnerability: how each attack works at the code level, and the exact fix for each one.
- Critical
The alg:none Attack
The JWT alg:none attack (CVE-2015-9235) lets an attacker forge arbitrary tokens by removing the signature and setting alg to none. Learn how the attack works and the exact fix for every JWT library.
- Critical
Algorithm Confusion (RS256 → HS256)
JWT algorithm confusion tricks RS256 verifiers into accepting HS256-signed tokens using the RSA public key as the HMAC secret. Learn how the attack works, the step-by-step exploit, and the one-line fix.
- High
Weak HMAC Secret Keys
Weak HS256 secrets can be brute-forced offline with hashcat once an attacker obtains any valid JWT. Learn what makes a secret weak, how the attack works, and how to generate a strong secret.
- High
kid Parameter Injection
JWT kid header injection lets an attacker use SQL injection or path traversal via the kid parameter to force the verifier into using an attacker-controlled key. Learn the attack and the allowlist fix.
- High
Missing Audience Validation
Skipping JWT aud validation enables the confused deputy attack: a token issued for one service is replayed against another sharing the same signing key. Learn the attack and the one-line fix.
- High
Excessive Token Lifetime
JWTs without exp or with multi-year lifetimes turn a single leak into permanent credential exposure. Learn recommended token lifetimes, why short exp matters, and refresh-token rotation.
Complete Security Guide
For deeper coverage including token storage comparison, revocation strategies, and a security checklist, read the full guide.
Read the complete JWT security guide