CVE-2026-35041: 
JavaScript vulnerability analysis and mitigation

Overview

CVE-2026-35041 is a Regular Expression Denial of Service (ReDoS) vulnerability in the fast-jwt Node.js library, affecting versions 5.0.0 through 6.2.0. When the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce verification options are configured with a RegExp object containing nested quantifiers, an attacker can supply a crafted JWT aud claim that triggers catastrophic backtracking in the JavaScript regex engine, causing severe CPU exhaustion. The vulnerability was disclosed on April 9, 2026, and fixed in version 6.2.1. It carries a CVSS v3.1 base score of 6.5 (Medium) per NVD, though the GitHub advisory rates it 4.2 (Moderate) under a more restrictive scoring (GitHub Advisory).

Technical details

The root cause is CWE-1333 (Inefficient Regular Expression Complexity): the library passes attacker-controlled JWT claim values directly to application-supplied RegExp objects without validating whether those patterns are safe against catastrophic backtracking. When a pattern such as /^(a+)+X$/ is used for allowedAud, an adversarial aud value like "a".repeat(n) + "Y" causes exponential evaluation time — measured at ~123 ms for n=24, ~1.97 s for n=28, and ~7.85 s for n=30. Crucially, signature verification occurs before claim validation, meaning the attacker must possess a validly signed JWT, making this an authenticated (post-signature) denial-of-service. The fix in PR #595 integrates the safe-regex2 library to detect unsafe patterns at verifier creation time and emit a FAST_JWT_UNSAFE_REGEXP process warning (GitHub Advisory, Fix PR).

Impact

Successful exploitation causes CPU exhaustion on the Node.js server processing JWT verification, blocking the event loop and degrading or completely halting API throughput. Affected deployment contexts include API gateways, authentication middleware, service-to-service communication, and OAuth/OIDC token validation pipelines. There is no confidentiality or integrity impact; the sole consequence is availability loss, which can cascade into service outages, increased serverless execution costs, and saturation of authentication infrastructure (GitHub Advisory).

Exploitability

A proof-of-concept exploit (poc-suite-redos-fastjwt.js) is publicly referenced in the GitHub security advisory, with concrete reproduction steps. Exploitation requires the attacker to hold a validly signed JWT and have control over the aud claim — feasible in shared-secret environments, internal microservice architectures, or OAuth/OIDC flows. There is no evidence of in-the-wild exploitation at this time, and the vulnerability is not listed in the CISA KEV catalog. The EPSS score is approximately 0.03% (GitHub Advisory, Feedly).

Exploitation steps

  1. Identify target configuration: Determine whether the target application uses fast-jwt versions 5.0.0–6.2.0 with a RegExp object (e.g., /^(a+)+X$/) in allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options.
  2. Obtain a valid signed JWT: Acquire or forge a validly signed JWT using a known shared secret, a compromised signing key, or through a legitimate authentication flow that issues tokens to the attacker.
  3. Craft adversarial aud claim: Set the aud claim to a string designed to trigger catastrophic backtracking against the target regex — for example, "a".repeat(28) + "Y" against a pattern like /^(a+)+X$/.
  4. Send crafted JWT to the verifier endpoint: Submit the crafted JWT to any API endpoint or middleware that invokes fast-jwt's createVerifier() with the vulnerable RegExp option.
  5. Trigger CPU exhaustion: Each verification attempt with the adversarial payload consumes multiple seconds of CPU time; repeated requests saturate the Node.js event loop, causing denial of service (GitHub Advisory).

Indicators of compromise

  • Logs: Unusually high JWT verification latency in application logs; repeated requests to authentication or token-validation endpoints with the same or similar aud values.
  • Process: Node.js process showing sustained near-100% CPU utilization during JWT verification operations; event loop lag metrics spiking to multiple seconds.
  • Network: High-frequency requests to JWT-protected endpoints from a single source IP or a small set of IPs, particularly with tokens bearing long, repetitive aud claim strings.
  • Application Warnings: Node.js process warning with code FAST_JWT_UNSAFE_REGEXP emitted at startup (after upgrading to 6.2.1), indicating a previously unsafe RegExp was in use (GitHub Advisory, Fix Commit).

Mitigation and workarounds

Upgrade fast-jwt to version 6.2.1 or later, which adds construction-time detection of unsafe RegExp patterns via the safe-regex2 library and emits a FAST_JWT_UNSAFE_REGEXP warning for any vulnerable configuration. As an interim workaround, replace RegExp-based allowedAud/allowedIss/allowedSub/allowedJti/allowedNonce options with string values where possible, or ensure any RegExp used does not contain nested quantifiers (e.g., (a+)+, (a*)+, (\w+)+). Additionally, implement rate limiting and request timeouts on JWT verification endpoints to limit the blast radius of any exploitation attempt (GitHub Advisory, Release v6.2.1).

Additional resources


Source: This report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-966w-4vpf-p7hcHIGH7.1
  • JavaScript logoJavaScript
  • @aloma.io/aloma
NoYesOct 25, 2026
GHSA-mrwp-f3q8-3g9pMEDIUM5.9
  • JavaScript logoJavaScript
  • follow-redirects
NoYesOct 25, 2026
GHSA-hfm3-x63j-7fxpHIGHN/A
  • JavaScript logoJavaScript
  • @payload-auth-link/migrate
NoYesOct 25, 2026
GHSA-6244-vvv9-76f5MEDIUMN/A
  • JavaScript logoJavaScript
  • @payload-auth-link/plugin
NoYesOct 25, 2026
GHSA-q53q-qg98-p9jfHIGHN/A
  • JavaScript logoJavaScript
  • llm-fw
NoYesOct 25, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management