JWT algorithm confusion returns in fast-jwt, enabling auth bypass
TL;DR — A Critical JWT algorithm confusion bug in fast-jwt can let attackers forge tokens by tricking RSA public keys into being treated as HMAC secrets (a patch-bypass of an earlier fix).
What happened
fast-jwt is a popular npm library used to sign and verify JSON Web Tokens in Node.js services.
A newly published CVE record, CVE-2026-34950, reports that fast-jwt has an incomplete fix for a prior JWT algorithm confusion vulnerability: the library’s public-key detection regex can be defeated by leading whitespace in the supplied key string, re-enabling the same “public key treated as shared secret” confusion class. The CVE describes the issue as affecting 6.1.0 and earlier and assigns CVSS v3.1 9.1 (Critical) with network attack vector and no privileges required.
This is notable operationally because it’s a patch-bypass in a security-sensitive auth primitive (JWT verification). Canonicalization/normalization issues (like whitespace handling) are a recurring root cause in crypto and identity libraries, and they tend to surface in real deployments via config formats, environment variables, and key material storage quirks.
Who is impacted
- Services that use
fast-jwtfor authentication/authorization decisions (session tokens, API auth, service-to-service auth). - Projects with a dependency on
fast-jwtversions reported as affected in the CVE record.
| Item | Source value |
|---|---|
| Affected package | fast-jwt (npm) |
| Affected versions | <= 6.1.0 |
| Severity | CVSS v3.1 9.1 (Critical) |
| Vulnerability class | JWT algorithm confusion (CWE-327) |
What to do now
- Follow vendor remediation guidance for
fast-jwt/nearformas it becomes available. - Inventory where
fast-jwtis used in production (lockfiles, SBOM/SCA results, container images) and prioritize services where JWT verification gates privileged actions. - If you cannot immediately apply a vendor fix, reduce exposure by hardening JWT verification patterns:
- Avoid relying on automatic key/algorithm detection in verification flows.
- Normalize/validate key material before use (the issue is triggered by leading whitespace handling in key strings).
- Treat suspicious token acceptance as a potential auth bypass signal:
- Review auth logs for unexpected privilege escalation and anomalous token usage.
- Rotate secrets/credentials reachable via JWT-granted privileges if compromise is suspected.
Content is AI-assisted and reviewed by our team, but issues may be missed and best practices evolve rapidly, send corrections to [email protected]. Always consult official documentation and validate key implementation decisions before making design or security choices.
