JWT Issues
Misused JSON Web Tokens - alg confusion, none, weak secrets, and missing validation - break authentication.
Overview
Servers that don’t pin the algorithm or verify the signature accept alg:none, allow RS256→HS256 confusion (signing with the public key as HMAC secret), or fall to brute-forced weak HMAC secrets.
How it works
Servers that don’t pin the algorithm or verify the signature accept alg:none, allow RS256→HS256 confusion (signing with the public key as HMAC secret), or fall to brute-forced weak HMAC secrets.
Example
Impact
Token forgery, privilege escalation, and persistent account takeover.
Detection
Tamper alg/claims, test none and key-confusion, and attempt secret brute force on HS256 tokens.
Prevention
- Pin the expected algorithm server-side and reject others (no none).
- Use strong, rotated secrets / proper key management.
- Validate signature, iss, aud, and exp on every request.
- Keep token lifetimes short and support revocation.