CVE-2026-107724: fast-jwt Token Forgery via Misclassified JWK JSON
Summary
CVE-2026-107724: fast-jwt treats raw public JWK JSON as an HMAC secret, enabling HS256 token forgery. Affects fast-jwt versions >= 6.2.4, < 6.3.0. Fixed in 6.3.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
fast-jwt is a popular library in the Node.js ecosystem used for creating and verifying JSON Web Tokens (JWTs). It provides a simple interface for handling JWTs, supporting various algorithms for signing and verification. However, a critical vulnerability has been identified in version 6.2.4, where raw public JSON Web Key (JWK) is incorrectly treated as an HMAC secret, leading to potential token forgery.
Vulnerability Detail
The vulnerability arises from the way fast-jwt classifies input keys. In version 6.2.4, raw serialized public JWK JSON is mistakenly classified as an HMAC secret when it does not match PEM public-key formats. This misclassification allows an attacker to forge HS256 tokens using the public JWK as an HMAC key, leading to authentication or authorization bypass. The attacker can create valid tokens with arbitrary claims, which may result in unauthorized access to sensitive data or elevated privileges.
How To Fix
Latest published version: 6.3.5 as of 22 Oct 2026
npm install fast-jwt@6.3.5
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
6.3.0
This is the first release that contains the fix.
npm install fast-jwt@6.3.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid passing raw serialized public JWK or JWKS JSON text as the verifier key. Instead, use PEM-encoded public keys for verification. This can be done by generating a PEM key pair and using the public key in your verification process.
Conclusion
The fast-jwt library has a significant vulnerability that allows for token forgery due to the misclassification of public JWK JSON as HMAC secrets. It is crucial for users of this library to update to the patched version 6.3.0 or later to ensure the security of their applications. Additionally, using PEM-encoded keys can help mitigate risks until the update is applied.
See every vulnerability recorded for fast-jwt →
FAQ
The CVSS score of this vulnerability is 7.4, indicating a high severity level.
The affected version is fast-jwt 6.2.4. Versions 6.3.0 and later have the vulnerability fixed.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without needing to sign up.
An attacker could forge JWT claims, leading to authentication bypass, unauthorized access, or privilege escalation within the application.
Yes, you can mitigate the risk by avoiding the use of raw public JWK or JWKS JSON as verifier keys and instead using PEM-encoded public keys.
References
Related vulnerabilities
Recent vulnerabilities recorded for fast-jwt.