CRITICAL🇵🇱 Wersja polska

CVE-2026-44351

CVSS 9.1v3.1pub. 2026-05-13upd. 2026-05-14

fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to 6.2.4, a critical authentication-bypass vulnerability in fast-jwt's async key-resolver flow allows any unauthenticated attacker to forge arbitrary JWTs that are accepted as authentic. When the application's key resolver returns an empty string (''), for example via the common keys[decoded.header.kid] || '' JWKS-style fallback, fast-jwt converts it to a zero-length Buffer, hands it to crypto.createSecretKey, derives allowedAlgorithms = ['HS256','HS384','HS512'] from it, and then verifies the token's signature against an empty-key HMAC. The attacker simply computes HMAC-SHA256(key='', input='${header}.${payload}'), which Node accepts without complaint — and the verifier returns the attacker-chosen payload (sub, admin, scopes, etc.) as authentic. This vulnerability is fixed in 6.2.4.

🤖 AI Analysis
How it works

When an application uses a key-resolver returning an empty string ('') as a fallback (e.g., pattern keys[decoded.header.kid] || '' in JWKS style), fast-jwt converts it to a zero-length Buffer and passes it to crypto.createSecretKey. Based on this, the library derives allowed algorithms ['HS256','HS384','HS512'] and verifies the token signature using HMAC with an empty key. The attacker independently calculates HMAC-SHA256 with an empty key for any arbitrarily constructed header and payload — Node.js accepts such an operation without error, and the verifier returns the token as authentic along with attacker-defined fields (sub, admin, scopes, etc.).

Impact

An attacker can forge any JWT token with fields of their choice (e.g., user identity, admin role, permission scopes) and gain unauthorized access to protected application resources.

Mitigation & patch

The fast-jwt library should be updated to version 6.2.4 or later. Additionally, it is recommended to review key-resolver implementations to eliminate patterns returning an empty string as a fallback value — missing keys should result in an explicit error, not a silent substitution with an empty string.

Who is affected

The fast-jwt library in all versions before 6.2.4, in applications using an asynchronous key-resolver returning an empty string as a fallback value.

Analysis generated by Claude AI (Anthropic) based on NVD data. Always verify with vendor.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
🔵
CHECK WITH VENDOR
No clear patch data available. Check vendor references.
Tags
Auth Bypass
CWE
References