1. Executive Summary & Scope
JSON Web Tokens (JWT) are widely used for stateless API authentication. Flaws in token validation libraries—such as accepting unsigned tokens (`alg: none`), confusing symmetric (HMAC) and asymmetric (RSA/ECDSA) keys, or failing to enforce expiration (`exp`)—enable attackers to forge arbitrary identities.
2. Threat Model & Attack Vectors
An attacker tampers with the token payload to set `"role": "admin"`, changes the header algorithm to `"none"` or signs with the public key against an HMAC verifier, bypassing authentication entirely.
3. Code Analysis & Remediation Playbook
Vulnerable Implementation Pattern
Hardened Defense-in-Depth Implementation
4. Audit Verification Checklist & Pass Criteria
| Verification Phase | Audit Test Description | Mandatory Passing Criteria |
|---|---|---|
| Alg: None Injection | Submit token with header `{"alg":"none","typ":"JWT"}` with stripped signature. | Server rejects token with 401 Unauthorized. |
| Algorithm Confusion (HMAC vs RSA) | Sign token using RSA public key string as secret key with HS256 algorithm. | Server rejects HS256 algorithm when configured for RS256 public keys. |
| Expired Token Replay | Submit token where `exp` timestamp is 60 seconds in the past. | Server rejects token and requires re-authentication. |
WebOTG Application Security Directorate
WebOTG provides benchmark reference documentation, automated matrix evaluators, and security test harnesses for government digital platforms, WQMS architectures, and STQC compliance frameworks.