Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessObtain target's public RSA key bytes
-
DeliveryConfirm verifier loads key with non-whitespace prefix and allows HS256
-
ExploitForge HS256 JWT using public key as HMAC secret
-
ExecutionSubmit forged token to verifier
-
ImpactBypass authentication/authorization
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A04:2025 - Cryptographic Failures
ASVS 5.0
V11 - Cryptography Signature verification
|
| Exploitation Conditions | Exploitation requires BOTH: (1) the fast-jwt verifier loads the RSA/EC public key from a source that left non-whitespace content before the '-----BEGIN PUBLIC KEY-----' header - e.g., a '#' or '//' comment line, an HTTP-style header, a PGP/wrapper prefix, or control/zero-width Unicode (NUL, ESC, U+200B zero-width space, U+200D ZWJ, U+FEFF) introduced via DB encoding corruption, YAML inline comments, or copy-paste from formatted documents; and (2) HS256 is inferred or allowed by the verifier. The attacker must also know the target's public key, which is public by definition. The attack is fully PREVENTED by configuring an asymmetric-only algorithm allowlist (so HS256 is never accepted), and clean PEM keys with no leading bytes are not misclassified - these limiting factors mean the default-with-clean-key case is not exploitable despite the AV:N/PR:N CVSS metrics. |
| Impact | The input CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/C:H/I:H/A:H = 9.8 Critical) presents this as a trivially exploitable remote unauthenticated flaw, but that score overstates real-world exploitability because it ignores two hard preconditions visible in the description and GHSA advisory: the verifier must (a) load the RSA public key from a source that introduced a non-whitespace leading byte, and (b) infer or allow HS256 with no asymmetric-only algorithm allowlist. These are non-default conditions, so AC:L is optimistic - AC:H is more faithful. No EPSS score was provided in the input, and the CVE is NOT on CISA KEV, so there is no evidence of active exploitation; however, a verified 10-line PoC and a full fix PR with regression tests are public, meaning publicly available exploit code exists and the technique (RSA→HS256 algorithm confusion, CWE-347) is well-understood and reliable where the preconditions hold. This is the incomplete-fix successor to CVE-2026-34950 / CVE-2023-48223, a lineage that raises the likelihood of opportunistic testing against known fast-jwt deployments. Net: a genuine high-priority patch item for anyone running fast-jwt 6.2.0-6.2.4 who does not pin an asymmetric algorithm allowlist, but the conditional nature means it is not a blanket internet-wide auto-exploitable 9.8 against every default install. |
| Exploit ScenarioDerived | A service uses fast-jwt (6.2.0-6.2.4) to verify RSA-signed JWTs but loads its public key from a store that prepends non-whitespace content (e.g., a YAML inline comment, a corrupted DB column, or copy-pasted text with a zero-width character). An attacker who knows the public key (public by definition) forges an HS256 token using the public-key bytes as the HMAC secret; because the PEM header is no longer at position 0, fast-jwt misclassifies the key as an HMAC secret and accepts the forged token, bypassing authentication. A verified public PoC exists demonstrating this with the latest affected release. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 08, 2026
Authentication and authorization bypass in fast-jwt 6.2.0 through 6.2.4 (npm, NearForm) lets a remote, unauthenticated attacker forge valid HS256 JWTs using the service's own RSA public key, because non-whitespace bytes ahead of the PEM header cause the library to misclassify the public key as an HMAC shared secret. Exploitation is not trivial and depends on two preconditions being met at once: the verifier must load the asymmetric key from a source that left content such as a '#' or '//' comment line, an HTTP-style header, a PGP/text wrapper, or control or zero-width Unicode (NUL, ESC, U+200B, U+200D, U+FEFF) before '-----BEGIN PUBLIC KEY-----', and the verifier must infer or allow HS256 rather than enforcing an asymmetric-only algorithm allowlist; clean PEM keys and asymmetric-only configurations are not affected. Publicly available exploit code exists (a working PoC is included in the vendor GHSA advisory), no CISA KEV listing or active exploitation is indicated, and the supplied 9.8 CVSS overstates real-world exploitability - the independently assessed vector is AV:N/AC:H/PR:N/UI:N with no availability impact, consistent with the two hard preconditions above.
RemediationAI
Upgrade to fast-jwt 6.3.0 or later (npm install fast-jwt@6.3.0), the vendor-released fix, per the advisory https://github.com/nearform/fast-jwt/security/advisories/GHSA-ww5h-9m49-7xx4, PR https://github.com/nearform/fast-jwt/pull/632, commit https://github.com/nearform/fast-jwt/commit/d96bbc6c5336055a6dbfa318fdbab01197264cfa, and release https://github.com/nearform/fast-jwt/releases/tag/v6.3.0. Before upgrading, note the behavioral change: 6.3.0 raises TokenError (invalidKey) for unrecognized or unsupported PEM headers instead of silently treating them as raw HMAC secrets, so key-loading paths that previously accepted stray or wrapper-prefixed PEM text as a 'secret' will now be rejected - audit and clean those inputs. The strongest compensating control, which fully prevents the attack even on unpatched 6.2.x, is to configure an asymmetric-only algorithm allowlist on the verifier (e.g. algorithms: ['RS256'], or the single exact algorithm expected), since HS256 is then never accepted regardless of how the key is classified; the trade-off is that any service that genuinely also needs HMAC-verified tokens must instantiate a separate verifier with its own policy. In addition, normalize key material at load time by stripping everything before the first '-----BEGIN ...-----' header (equivalent to the 6.3.0 locatePem logic) and rejecting keys that contain a PEM header but no recognized one, rather than allowing them to reach an HMAC fallback, and fix the upstream source of the dirty bytes (DB encoding corruption, YAML inline comments, copy-paste, HTTP/PGP wrappers). Because the attacker only needs the public key, treat public keys as non-secret and monitor for HS256 tokens presented to endpoints that should only accept asymmetric algorithms.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
fast-jwt is a Node.js JSON Web Token library (npm, maintained by NearForm) that auto-detects the signing algorithm from the key material passed to createVerifier/createDecoder. In the affected path, performDetectPublicKeyAlgorithms() in src/crypto.js applies key.trim() and then tests the result against the start-anchored matcher publicKeyPemMatcher = /^-----BEGIN(?: (RSA))? PUBLIC KEY-----/. Because String.prototype.trim() removes only characters the ECMAScript spec classifies as whitespace (U+0009-U+000D, U+0020, U+00A0, U+1680, U+2000-U+200A, U+2028, U+2029, U+202F, U+205F, U+3000, U+FEFF), any other leading byte keeps the PEM header off position 0, the anchored matcher fails, and execution falls through to the HMAC branch where the full key string - including public-key bytes the attacker already knows - is used as the HS256 secret. This is CWE-347 (Improper Verification of Cryptographic Signature), the same root-cause class as CVE-2023-48223 and CVE-2026-34950: the v6.2.0 fix for CVE-2026-34950 added trim() but narrowed only the whitespace case instead of addressing the class, which the vendor explicitly frames as an incomplete-fix lineage. The 6.3.0 fix introduces an unanchored pemBeginMatcher (/-----BEGIN [A-Z0-9 ]+?-----/) and a shared locatePem() helper that slices the key from its first PEM header and classifies by that header so the private- and public-key detectors can no longer drift apart; it also throws TokenError(codes.invalidKey, 'Unsupported PEM ...') for unrecognized PEM headers rather than silently treating them as raw HMAC secrets. The input CVSS 3.1 vector (9.8, AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) assumes the worst case; the assessed vector is AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N because both a dirty key source and an HS256-permissive verifier are required.
Know when Jwt Attack gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Remote and unauthenticated (AV:N/PR:N), but requires a non-default key-prefix condition plus HS256 allowed, so AC:H; signature forgery yields auth/authz bypass (C:H/I:H) with no direct availability impact (A:N).
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
fast-jwt provides fast JSON Web Token (JWT) implementation. From 6.2.0 until 6.3.0, fast-jwt can misclassify RSA public-key text as an HMAC secret when the key has non-whitespace content before its PEM header. In src/crypto.js, performDetectPublicKeyAlgorithms trims whitespace but publicKeyPemMatcher remains start-anchored, so comments, control characters, zero-width characters, or wrapper text can prevent PEM detection and reach the HMAC fallback. An attacker who knows the public key bytes can sign arbitrary HS256 claims with that public material when HS256 is inferred or allowed, resulting in authentication or authorization bypass. An asymmetric-only algorithm allowlist prevents the attack. This issue is fixed in version 6.3.0.
Articles & Coverage 1
Technical POC Analysis
Bug class: CWE-347, Improper Verification of Cryptographic Signature.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Latest POC
1 public PoC link from github
Sign in to open the public PoC links collected for this CVE.
Executive ViewAI
Organizations using the npm fast-jwt library versions 6.2.0 through 6.2.4 face a critical authentication weakness that can let attackers forge valid tokens and bypass access controls in affected applications. Because no vendor-released patch is identified at time of analysis and publicly available exploit code exists, leadership should treat any exposed service using these versions as high risk and prioritize inventory plus compensating controls. The issue is most dangerous for applications that load public keys from imperfect sources and allow HS256, so remediation depends on both configuration hardening and future patching.
No vendor-released patch identified at time of analysis; enforce asymmetric-only algorithm allowlists (e.g., RS256/PS256/ES256), reject HS256 in verifiers using RSA public keys, sanitize and validate PEM keys by stripping/rejecting any non-PEM bytes before '-----BEGIN PUBLIC KEY-----' including comment lines, HTTP-style headers, PGP/text wrappers, and control/zero-width Unicode (NUL, ESC, U+200B, U+200D, U+FEFF), load keys only from clean trusted sources, rotate keys and invalidate sessions if vulnerable configurations were exposed, and monitor for anomalous JWT acceptance.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.
More in Jwt Attack
View allWhy is Microsoft republishing a CVE from 2013? We are republishing CVE-2013-3900 in the Security Update Guide to update
Authentication bypass in SimpleHelp 5.5.15 and prior (plus 6.0 pre-release builds) allows remote unauthenticated attacke
Authentication bypass in WSO2 API Manager and related components (Universal Gateway, Traffic Manager, API Control Plane,
Authentication bypass in Fortinet FortiOS, FortiProxy, and FortiSwitchManager allows unauthenticated remote attackers to
ruby-saml provides security assertion markup language (SAML) single sign-on (SSO) for Ruby. Rated critical severity (CVS
ruby-saml provides security assertion markup language (SAML) single sign-on (SSO) for Ruby. Rated critical severity (CVS
The package jsrsasign before 10.5.25 are vulnerable to Improper Verification of Cryptographic Signature when JWS or JWT
A library injection vulnerability exists in Microsoft Teams (work or school) 24046.2813.2770.1094 for macOS. Rated criti
A library injection vulnerability exists in the WebView.app helper app of Microsoft Teams (work or school) 24046.2813.27
A library injection vulnerability exists in the com.microsoft.teams2.modulehost.app helper app of Microsoft Teams (work
The Ruby SAML library is for implementing the client side of a SAML authorization. Rated critical severity (CVSS 9.8), t
cosign is a container signing and verification utility. Rated critical severity (CVSS 9.8), this vulnerability is remote
EUVD-2026-95347
GHSA-ww5h-9m49-7xx4
NVD
CVE.org
EPSS
VulDB
Exploit-DB