
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-35040 is a logical denial-of-service vulnerability in the fast-jwt npm package (by NearForm) caused by stateful RegExp modifiers in JWT claim validation options. When applications configure allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce with RegExp objects using the /g (global) or /y (sticky) flags, the verifier produces non-deterministic results — rejecting valid tokens in an alternating PASS/FAIL pattern (~50% failure rate). All versions prior to 6.2.1 are affected. The vulnerability was disclosed on April 9, 2026, with a CVSS v3.1 base score of 5.3 (Medium) (Github Advisory, Security Advisory).
The root cause lies in JavaScript's RegExp.prototype.test() being stateful when the /g or /y flags are set — each invocation mutates the lastIndex property on the RegExp object. In src/verifier.js, the ensureStringClaimMatcher() function returned RegExp objects directly, and validateClaimValues() called .test() on them repeatedly via allowed.some(a => a.test(v)) without resetting lastIndex. This causes every second call to fail for a perfectly valid token. The vulnerability is classified as CWE-440 (Expected Behavior Violation) and CWE-697 (Incorrect Comparison), and only affects deployments explicitly using RegExp objects with stateful modifiers in the allowed* claim options — string-based patterns are unaffected (Security Advisory, Fix PR).
The vulnerability causes a logical denial-of-service affecting authentication availability: approximately 50% of valid JWT authentication requests are incorrectly rejected in an alternating pattern, leading to intermittent user authentication failures. This can trigger retry storms in API gateways and authentication middleware, cascade into broader service degradation, and generate false-positive operational alerts. There is no confidentiality or integrity impact — invalid tokens cannot be accepted as a result of this flaw (Github Advisory).
A public proof-of-concept (PoC) Node.js script is available in the official security advisory, demonstrating the alternating PASS/FAIL behavior across all affected allowed* claim options (Security Advisory). There is no evidence of in-the-wild exploitation at this time, and no threat actor attribution has been reported. The EPSS score is approximately 0.061% (0.182% per GitHub Advisory), placing it in the lower percentiles for near-term exploitation likelihood. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.
fast-jwt versions prior to 6.2.1 and configures any allowed* claim option (e.g., allowedAud, allowedIss) with a RegExp using the /g or /y flag.lastIndex mutation, every second verification call will fail.FAST_JWT_* error codes) for the same valid token in application logs, appearing in a strict alternating pattern with successful verifications.Upgrade fast-jwt to version 6.2.1 or later, which wraps RegExp matchers in ensureStringClaimMatcher() to reset lastIndex = 0 before each .test() call, making validation deterministic (Release v6.2.1, Fix PR). As an immediate workaround without upgrading, remove the /g or /y flags from any RegExp used in allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options — for example, replace allowedAud: /^admin$/g with allowedAud: /^admin$/. Applications using string-based patterns for these options are not affected and require no changes (Github Advisory).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."