JWT Security Vulnerability: Algorithm Confusion (RS256 Public Key Verified as HS256)
Verifier trusted the untrusted JWT header `alg` field instead of pinning the expected algorithm.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: JWT Security Vulnerability
Platform: Security
Common Root Causes:
- Verifier trusted the untrusted JWT header `alg` field instead of pinning the expected algorithm.
Interactive Diagnostic Checklist
Verified Solutions:
- Always pass an explicit single-element `algorithms` allowlist to JWT verification.
Safe Diagnostic Command:
Audit `jwt.verify(token, key, { algorithms: ["RS256"] })`Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Verifier trusted the untrusted JWT header `alg` field instead of pinning the expected algorithm. Recommended diagnostic: `Audit `jwt.verify(token, key, { algorithms: ["RS256"] })``. Remediation: Always pass an explicit single-element `algorithms` allowlist to JWT verification.
Worked Examples
- Run `Audit `jwt.verify(token, key, { algorithms: ["RS256"] })`` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-sec-jwt-alg-none-confusion · Independently verified: 2026-11-25