This vulnerability ONLY affects applications that:
allowedAud: /^(a+)+X$/ ← VULNERABLEallowedAud: "api.company.com" ← SAFETo determine if you're affected:
/pattern/ or new RegExp())(a+)+, (.*)*, etc.A denial-of-service condition exists in fast-jwt when the allowedAud verification option is configured using a regular expression.
Because the aud claim is attacker-controlled and the library evaluates it against the supplied RegExp, a crafted JWT can trigger catastrophic backtracking in the JavaScript regex engine, resulting in significant CPU consumption during verification.
This occurs with a validly signed JWT, making the issue exploitable in authenticated contexts such as:
API gateways
authentication middleware
service-to-service communication
OAuth / OIDC token validation pipelines
Library: fast-jwt
Version tested: 6.1.0
Runtime: Node.js v24.13.1
Feature: claim validation using allowedAud: RegExp
CPU exhaustion / Denial of Service
A crafted JWT causes verification to take multiple seconds per request due to catastrophic regex backtracking.
This is sufficient to:
block Node.js event loop threads
degrade API throughput
cause cascading service failures
increase serverless execution costs
saturate authentication infrastructure
The library allows regular expressions in claim validation:
allowedAud: /^(a+)+X$/
The aud claim is attacker-controlled:
aud = "a".repeat(n) + "Y"
This creates catastrophic backtracking in the JavaScript regex engine.
Verification time grows exponentially as input length increases.
Attack requires:
a valid signed JWT (post-authentication context)
attacker control over the aud claim
a vulnerable regex configured by the application
shared HS secrets
internal JWT issuance
microservice authentication
OAuth / OIDC custom audiences
internal service tokens
Install fast-jwt
Configure verifier with a RegExp in allowedAud
Send a valid signed JWT with adversarial aud
poc-suite-redos-fastjwt.js
evidence-redos-fastjwt.json
Verification CPU time increases from milliseconds to multiple seconds as input length grows.
CWE-1333: Inefficient Regular Expression
CWE-400: Uncontrolled Resource Consumption
Class: Authenticated Denial of Service
The library should prevent unbounded CPU work on attacker-controlled claims.
safe-regex validation
maximum length enforcement for claims
regex complexity limits
documentation warning about ReDoS risks when using RegExp-based validation
Signature verification occurs before claim validation, therefore this is not a pre-authentication DoS.
However, the vulnerability remains exploitable in authenticated or token-bearing contexts and can significantly impact production environments.
{
"cwe_ids": [
"CWE-1333"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-09T16:41:40Z",
"nvd_published_at": "2026-04-09T16:16:27Z",
"severity": "MODERATE"
}