CVE-2026-35040: fast-jwt Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-3j8v-cgw4-2g6q
CVSS 5.3
CWE-440 CWE-697
Published
Advisory Summary

CVE-2026-35040 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-440: Expected Behavior Violation) affecting fast-jwt libraries in the npm ecosystem. The issue involves stateful regexp (/g or /y) causes non-deterministic allowed-claim validation (logical dos). Remediation is available by upgrading affected packages to version 6.2.1.

CVE-2026-35040 at a Glance

CVE Identifier CVE-2026-35040
GHSA Identifier GHSA-3j8v-cgw4-2g6q
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-440: Expected Behavior Violation
Affected Product fast-jwt
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-35040

To remediate this vulnerability, upgrade all affected fast-jwt dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

fast-jwt fixed: 6.2.1
npm install fast-jwt@6.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls fast-jwt

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-35040, inspect your project dependencies using npm:

npm ls fast-jwt

Analyze the terminal output to locate any version of fast-jwt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.2.1), your application is affected.

Note: The npm ls fast-jwt command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-440: Expected Behavior Violation, where a feature, api, or function does not perform according to its specification. In fast-jwt, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Impact Using certain modifiers on RegExp objects in the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options in verify functions can cause certain unintended behaviours. This is because some modifiers are stateful and will cause failures in every second verification attempt regardless of the validity of the token provided. Such modifiers are: - /g : Global matching - /y : Sticky matching This does NOT allow invalid tokens to be accepted, only for valid tokens to be improperly rejected in some configurations. Instead it causes **50% of valid authentication requests to fail** in an alternating pattern, leading to: - Intermittent user authentication failures - Potential retry storms in applications - Operational monitoring alerts ## Affected Configurations ### This vulnerability ONLY affects applications that: - Use RegExp objects (not strings) in the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options - Use stateful RegExp modifiers such a /g or /y Example: allowedAud: /abc/g ← IMPACTED Example: allowedAud: "/abc/" ← SAFE ### Not Affected - Applications using string patterns for audience validation (most common) - Applications using RegExp patterns without stateful modifiers ### Assessment Guide To determine if you're affected: Check if allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options use RegExp objects (/pattern/ or new RegExp()) If yes, review the pattern for stateful modifiers like /g, /y If no RegExp usage or no stateful modifiers, you are NOT affected ## Mitigation Options While a fix will be coming in the next version of the package you can take steps to mitigate the issue immediately by removing any such modifiers (/g, /y) from the regex. --- Summary fast-jwt accepts RegExp for allowedAud, allowedIss, allowedSub, allowedJti, and allowedNonce. If the provided regular expression uses the g (global) or y (sticky) flag, verification becomes non-deterministic: the same valid token alternates between acceptance and rejection across successive calls. This occurs because RegExp.prototype.test() is stateful when g/y is set (it mutates lastIndex), and fast-jwt reuses the same RegExp object without resetting lastIndex. Affected component src/verifier.js ensureStringClaimMatcher() returns the RegExp object directly. validateClaimValues() performs repeated a.test(v) calls without resetting lastIndex. Impact Logical denial-of-service / authentication flapping. A valid signed JWT can be intermittently rejected. Causes unpredictable authentication outcomes across repeated verification calls. Can trigger retry storms and cascading failures in API gateways and authentication middleware. Affects any deployment that configures allowed* using RegExp and includes g or y flags. Root cause validateClaimValues() uses: allowed.some(a => a.test(v)) When `a` is a RegExp with g or y, `a.test()` mutates `a.lastIndex`. Subsequent calls against the same input can return different results. Proof of concept Environment - fast-jwt: 6.1.0 (repo HEAD) - Node.js: v24.13.1 PoC const { createSigner, createVerifier } = require('fast-jwt') const sign = createSigner({ key: 'secret' }) const token = sign({ aud: 'admin', iss: 'issuer' }) function run(name, opts) { const verify = createVerifier({ key: 'secret', ...opts }) console.log('\n==', name) for (let i = 0; i < 8; i++) { try { verify(token); console.log(i, 'PASS') } catch (e) { console.log(i, 'FAIL', e.code || e.message) } } } run('allowedAud global regex', { allowedAud: /^admin$/g }) run('allowedIss global regex', { allowedIss: /^issuer$/g }) run('control (non-global regex)', { allowedAud: /^admin$/ }) Observed behavior - allowedAud with `/g` alternates PASS/FAIL across calls - allowedIss with `/g` alternates PASS/FAIL across calls - control regex (no g/y) is deterministic and always PASS Expected behavior Validation must be deterministic. The same token under the same verifier configuration must always yield the same decision. Suggested fix (minimal and safe) Wrap RegExp matchers inside ensureStringClaimMatcher() to reset lastIndex before calling test(): if (r instanceof RegExp) { return { test: v => { r.lastIndex = 0; return r.test(v) } } } This preserves semantics for non-global regexes, makes g/y deterministic, and avoids changes in the rest of the verifier logic. Security classification Logical DoS / authentication reliability failure. This can be weaponized to produce production outages via retry storms and auth instability. Why this is not “misuse” - The library explicitly accepts RegExp for allowed* claim validation. - The behavior difference is caused by internal state mutation of RegExp.test(). - The same token, same verifier config, same runtime yields different outcomes. - Security decisions must be deterministic; non-determinism at the verification layer is a correctness flaw. - Consumers cannot reliably defend against this unless the library normalizes matcher state. Notes - Affects allowedAud, allowedIss, allowedSub, allowedJti, allowedNonce equally (shared matcher logic). - Independent from the previously reported ReDoS; this is a determinism and correctness failure that can still produce production DoS effects. PoC Code: 'use strict' /** * PoC: Stateful RegExp flags (g/y) cause non-deterministic allowed-claim validation * fast-jwt reuses the same RegExp object; RegExp.test() mutates lastIndex when g/y is set. * * This script prints a human-readable log AND writes evidence to JSON. * * Usage: * node poc_regex_state_evidence.js */ const fs = require('node:fs') const path = require('node:path') const { createSigner, createVerifier } = require('fast-jwt') const OUT_JSON = path.join(process.cwd(), 'evidence-regex-stateful-fastjwt.json') const OUT_LOG = path.join(process.cwd(), 'evidence-regex-stateful-fastjwt.log') // Make a stable, valid token const sign = createSigner({ key: 'secret' }) const token = sign({ aud: 'admin', iss: 'issuer', sub: 'subject', jti: 'id-123', nonce: 'nonce-xyz' }) function runCase(name, verifierOpts, iterations = 12) { const verify = createVerifier({ key: 'secret', ...verifierOpts }) const results = [] for (let i = 0; i < iterations; i++) { try { verify(token) results.push({ i, ok: true }) } catch (e) { results.push({ i, ok: false, code: e.code || null, message: e.message || String(e) }) } } return results } function summarize(results) { const seq = results.map(r => (r.ok ? 'PASS' : 'FAIL')).join(' ') const pass = results.filter(r => r.ok).length const fail = results.length - pass return { pass, fail, seq } } function printCase(name, opts, results) { const s = summarize(results) const lines = [] lines.push(`== ${name}`) lines.push(`opts: ${JSON.stringify(opts)}`) lines.push(`PASS=${s.pass} FAIL=${s.fail}`) lines.push(`sequence: ${s.seq}`) lines.push('') return lines.join('\n') } function main() { const meta = { poc: 'stateful-regexp-allowed-claims', package: 'fast-jwt', node: process.version, timestamp: new Date().toISOString(), note: 'RegExp.test is stateful when g/y flags are set; lastIndex mutation causes alternating PASS/FAIL.' } // Cases: g/y should flap, control should be stable const cases = [ { name: 'allowedAud with global RegExp /g (expected: flapping)', opts: { allowedAud: /^admin$/g } }, { name: 'allowedAud with sticky RegExp /y (expected: flapping)', opts: { allowedAud: /^admin$/y } }, { name: 'allowedIss with global RegExp /g (expected: flapping)', opts: { allowedIss: /^issuer$/g } }, { name: 'allowedSub with global RegExp /g (expected: flapping)', opts: { allowedSub: /^subject$/g } }, { name: 'allowedJti with global RegExp /g (expected: flapping)', opts: { allowedJti: /^id-123$/g } }, { name: 'allowedNonce with global RegExp /g (expected: flapping)', opts: { allowedNonce: /^nonce-xyz$/g } }, { name: 'CONTROL: allowedAud with non-global RegExp (expected: stable PASS)', opts: { allowedAud: /^admin$/ } } ] const evidence = { meta, token: { alg: 'HS256 (autodetected by fast-jwt)', signed: true, jwt: token }, cases: [] } let log = '' for (const c of cases) { const results = runCase(c.name, c.opts, 12) const s = summarize(results) evidence.cases.push({ name: c.name, opts: c.opts, iterations: results.length, pass: s.pass, fail: s.fail, sequence: s.seq, results }) log += printCase(c.name, c.opts, results) } fs.writeFileSync(OUT_JSON, JSON.stringify(evidence, null, 2)) fs.writeFileSync(OUT_LOG, log) console.log(log) console.log(`[+] Wrote JSON evidence: ${OUT_JSON}`) console.log(`[+] Wrote LOG evidence : ${OUT_LOG}`) } main() Output: PS C:\Users\Franciny Rojas\Desktop\crypto-research\fast-jwt> node .\poc_regex_state_evidence.js == allowedAud with global RegExp /g (expected: flapping) opts: {"allowedAud":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == allowedAud with sticky RegExp /y (expected: flapping) opts: {"allowedAud":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == allowedIss with global RegExp /g (expected: flapping) opts: {"allowedIss":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == allowedSub with global RegExp /g (expected: flapping) opts: {"allowedSub":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == allowedJti with global RegExp /g (expected: flapping) opts: {"allowedJti":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == allowedNonce with global RegExp /g (expected: flapping) opts: {"allowedNonce":{}} PASS=6 FAIL=6 sequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL == CONTROL: allowedAud with non-global RegExp (expected: stable PASS) opts: {"allowedAud":{}} PASS=12 FAIL=0 sequence: PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS [+] Wrote JSON evidence: C:\Users\Franciny Rojas\Desktop\crypto-research\fast-jwt\evidence-regex-stateful-fastjwt.json [+] Wrote LOG evidence : C:\Users\Franciny Rojas\Desktop\crypto-research\fast-jwt\evidence-regex-stateful-fastjwt.log PS C:\Users\Franciny Rojas\Desktop\crypto-research\fast-jwt>

CVE-2026-35040 Affected fast-jwt Versions

1 component(s)
Fixed Versions:
6.2.1
Product / Package Ecosystem Affected Versions Fixed Version
fast-jwt
npm
< 6.2.1
6.2.1

References

Frequently Asked Questions

What is CVE-2026-35040?
CVE-2026-35040 is a security vulnerability in fast-jwt involving Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS) under CWE-440: Expected Behavior Violation.
Which fast-jwt versions are affected?
Affected versions include releases prior to 6.2.1 across affected packages: fast-jwt.
What version fixes CVE-2026-35040?
Upgrading to 6.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fast-jwt affected?
Yes, fast-jwt is affected in releases prior to 6.2.1. Upgrade your dependency to 6.2.1 or later.
What is the CVSS score of CVE-2026-35040?
CVE-2026-35040 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-35040?
CVE-2026-35040 is classified under CWE-440: Expected Behavior Violation (A feature, API, or function does not perform according to its specification.).
How can I check npm dependencies for CVE-2026-35040?
Run the dependency tree command: 'npm ls fast-jwt'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3j8v-cgw4-2g6q",
  "modified" : "2026-04-09T19:05:11Z",
  "published" : "2026-04-09T16:41:20Z",
  "aliases" : [ "CVE-2026-35040" ],
  "summary" : "fast-jwt: Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS)",
  "details" : "## Impact\n\nUsing certain modifiers on RegExp objects in the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options in verify functions can cause certain unintended behaviours. This is because some modifiers are stateful and will cause failures in every second verification attempt regardless of the validity of the token provided.\n\nSuch modifiers are:\n- /g : Global matching\n- /y : Sticky matching\n\nThis does NOT allow invalid tokens to be accepted, only for valid tokens to be improperly rejected in some configurations. Instead it causes **50% of valid authentication requests to fail** in an alternating pattern, leading to:\n  - Intermittent user authentication failures\n  - Potential retry storms in applications\n  - Operational monitoring alerts\n\n## Affected Configurations\n\n### This vulnerability ONLY affects applications that:\n\n- Use RegExp objects (not strings) in the allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options\n- Use stateful RegExp modifiers such a /g or /y\n\nExample: allowedAud: /abc/g ← IMPACTED\nExample: allowedAud: \"/abc/\" ← SAFE\n\n### Not Affected\n\n- Applications using string patterns for audience validation (most common)\n- Applications using RegExp patterns without stateful modifiers\n\n### Assessment Guide\nTo determine if you're affected:\n\nCheck if  allowedAud, allowedIss, allowedSub, allowedJti, or allowedNonce options use RegExp objects (/pattern/ or new RegExp())\nIf yes, review the pattern for stateful modifiers like /g, /y\nIf no RegExp usage or no stateful modifiers, you are NOT affected\n\n## Mitigation Options\nWhile a fix will be coming in the next version of the package you can take steps to mitigate the issue immediately by removing any such modifiers (/g, /y) from the regex.\n\n---\n\nSummary\n\nfast-jwt accepts RegExp for allowedAud, allowedIss, allowedSub, allowedJti, and allowedNonce.\n\nIf the provided regular expression uses the g (global) or y (sticky) flag, verification becomes non-deterministic: the same valid token alternates between acceptance and rejection across successive calls.\n\nThis occurs because RegExp.prototype.test() is stateful when g/y is set (it mutates lastIndex), and fast-jwt reuses the same RegExp object without resetting lastIndex.\n\n\nAffected component\n\nsrc/verifier.js\n\nensureStringClaimMatcher() returns the RegExp object directly.\n\nvalidateClaimValues() performs repeated a.test(v) calls without resetting lastIndex.\n\n\nImpact\n\nLogical denial-of-service / authentication flapping.\n\nA valid signed JWT can be intermittently rejected.\n\nCauses unpredictable authentication outcomes across repeated verification calls.\n\nCan trigger retry storms and cascading failures in API gateways and authentication middleware.\n\nAffects any deployment that configures allowed* using RegExp and includes g or y flags.\n\n\nRoot cause\n\nvalidateClaimValues() uses: allowed.some(a => a.test(v))\n\n\nWhen `a` is a RegExp with g or y, `a.test()` mutates `a.lastIndex`.\n\nSubsequent calls against the same input can return different results.\n\n\nProof of concept\n\nEnvironment\n\n- fast-jwt: 6.1.0 (repo HEAD)\n- Node.js: v24.13.1\n\nPoC\nconst { createSigner, createVerifier } = require('fast-jwt')\n\nconst sign = createSigner({ key: 'secret' })\nconst token = sign({ aud: 'admin', iss: 'issuer' })\n\nfunction run(name, opts) {\nconst verify = createVerifier({ key: 'secret', ...opts })\nconsole.log('\\n==', name)\nfor (let i = 0; i < 8; i++) {\ntry { verify(token); console.log(i, 'PASS') }\ncatch (e) { console.log(i, 'FAIL', e.code || e.message) }\n}\n}\n\nrun('allowedAud global regex', { allowedAud: /^admin$/g })\nrun('allowedIss global regex', { allowedIss: /^issuer$/g })\nrun('control (non-global regex)', { allowedAud: /^admin$/ })\n\n\n\nObserved behavior\n\n- allowedAud with `/g` alternates PASS/FAIL across calls\n- allowedIss with `/g` alternates PASS/FAIL across calls\n- control regex (no g/y) is deterministic and always PASS\n\n\nExpected behavior\n\nValidation must be deterministic.\n\nThe same token under the same verifier configuration must always yield the same decision.\n\n\nSuggested fix (minimal and safe)\n\nWrap RegExp matchers inside ensureStringClaimMatcher() to reset lastIndex before calling test():\nif (r instanceof RegExp) {\nreturn { test: v => { r.lastIndex = 0; return r.test(v) } }\n}\n\n\nThis preserves semantics for non-global regexes, makes g/y deterministic, and avoids changes in the rest of the verifier logic.\n\n\nSecurity classification\n\nLogical DoS / authentication reliability failure.\n\nThis can be weaponized to produce production outages via retry storms and auth instability.\n\n\nWhy this is not “misuse”\n\n- The library explicitly accepts RegExp for allowed* claim validation.\n- The behavior difference is caused by internal state mutation of RegExp.test().\n- The same token, same verifier config, same runtime yields different outcomes.\n- Security decisions must be deterministic; non-determinism at the verification layer is a correctness flaw.\n- Consumers cannot reliably defend against this unless the library normalizes matcher state.\n\n\nNotes\n\n- Affects allowedAud, allowedIss, allowedSub, allowedJti, allowedNonce equally (shared matcher logic).\n- Independent from the previously reported ReDoS; this is a determinism and correctness failure that can still produce production DoS effects.\n\n\nPoC Code:\n'use strict'\n\n/**\n * PoC: Stateful RegExp flags (g/y) cause non-deterministic allowed-claim validation\n * fast-jwt reuses the same RegExp object; RegExp.test() mutates lastIndex when g/y is set.\n *\n * This script prints a human-readable log AND writes evidence to JSON.\n *\n * Usage:\n *   node poc_regex_state_evidence.js\n */\n\nconst fs = require('node:fs')\nconst path = require('node:path')\nconst { createSigner, createVerifier } = require('fast-jwt')\n\nconst OUT_JSON = path.join(process.cwd(), 'evidence-regex-stateful-fastjwt.json')\nconst OUT_LOG  = path.join(process.cwd(), 'evidence-regex-stateful-fastjwt.log')\n\n// Make a stable, valid token\nconst sign = createSigner({ key: 'secret' })\nconst token = sign({\n  aud: 'admin',\n  iss: 'issuer',\n  sub: 'subject',\n  jti: 'id-123',\n  nonce: 'nonce-xyz'\n})\n\nfunction runCase(name, verifierOpts, iterations = 12) {\n  const verify = createVerifier({ key: 'secret', ...verifierOpts })\n\n  const results = []\n  for (let i = 0; i < iterations; i++) {\n    try {\n      verify(token)\n      results.push({ i, ok: true })\n    } catch (e) {\n      results.push({ i, ok: false, code: e.code || null, message: e.message || String(e) })\n    }\n  }\n\n  return results\n}\n\nfunction summarize(results) {\n  const seq = results.map(r => (r.ok ? 'PASS' : 'FAIL')).join(' ')\n  const pass = results.filter(r => r.ok).length\n  const fail = results.length - pass\n  return { pass, fail, seq }\n}\n\nfunction printCase(name, opts, results) {\n  const s = summarize(results)\n  const lines = []\n  lines.push(`== ${name}`)\n  lines.push(`opts: ${JSON.stringify(opts)}`)\n  lines.push(`PASS=${s.pass} FAIL=${s.fail}`)\n  lines.push(`sequence: ${s.seq}`)\n  lines.push('')\n  return lines.join('\\n')\n}\n\nfunction main() {\n  const meta = {\n    poc: 'stateful-regexp-allowed-claims',\n    package: 'fast-jwt',\n    node: process.version,\n    timestamp: new Date().toISOString(),\n    note: 'RegExp.test is stateful when g/y flags are set; lastIndex mutation causes alternating PASS/FAIL.'\n  }\n\n  // Cases: g/y should flap, control should be stable\n  const cases = [\n    {\n      name: 'allowedAud with global RegExp /g (expected: flapping)',\n      opts: { allowedAud: /^admin$/g }\n    },\n    {\n      name: 'allowedAud with sticky RegExp /y (expected: flapping)',\n      opts: { allowedAud: /^admin$/y }\n    },\n    {\n      name: 'allowedIss with global RegExp /g (expected: flapping)',\n      opts: { allowedIss: /^issuer$/g }\n    },\n    {\n      name: 'allowedSub with global RegExp /g (expected: flapping)',\n      opts: { allowedSub: /^subject$/g }\n    },\n    {\n      name: 'allowedJti with global RegExp /g (expected: flapping)',\n      opts: { allowedJti: /^id-123$/g }\n    },\n    {\n      name: 'allowedNonce with global RegExp /g (expected: flapping)',\n      opts: { allowedNonce: /^nonce-xyz$/g }\n    },\n    {\n      name: 'CONTROL: allowedAud with non-global RegExp (expected: stable PASS)',\n      opts: { allowedAud: /^admin$/ }\n    }\n  ]\n\n  const evidence = {\n    meta,\n    token: {\n      alg: 'HS256 (autodetected by fast-jwt)',\n      signed: true,\n      jwt: token\n    },\n    cases: []\n  }\n\n  let log = ''\n  for (const c of cases) {\n    const results = runCase(c.name, c.opts, 12)\n    const s = summarize(results)\n\n    evidence.cases.push({\n      name: c.name,\n      opts: c.opts,\n      iterations: results.length,\n      pass: s.pass,\n      fail: s.fail,\n      sequence: s.seq,\n      results\n    })\n\n    log += printCase(c.name, c.opts, results)\n  }\n\n  fs.writeFileSync(OUT_JSON, JSON.stringify(evidence, null, 2))\n  fs.writeFileSync(OUT_LOG, log)\n\n  console.log(log)\n  console.log(`[+] Wrote JSON evidence: ${OUT_JSON}`)\n  console.log(`[+] Wrote LOG evidence : ${OUT_LOG}`)\n}\n\nmain()\n\n\nOutput:\nPS C:\\Users\\Franciny Rojas\\Desktop\\crypto-research\\fast-jwt> node .\\poc_regex_state_evidence.js\n== allowedAud with global RegExp /g (expected: flapping)\nopts: {\"allowedAud\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== allowedAud with sticky RegExp /y (expected: flapping)\nopts: {\"allowedAud\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== allowedIss with global RegExp /g (expected: flapping)\nopts: {\"allowedIss\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== allowedSub with global RegExp /g (expected: flapping)\nopts: {\"allowedSub\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== allowedJti with global RegExp /g (expected: flapping)\nopts: {\"allowedJti\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== allowedNonce with global RegExp /g (expected: flapping)\nopts: {\"allowedNonce\":{}}\nPASS=6 FAIL=6\nsequence: PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL PASS FAIL\n== CONTROL: allowedAud with non-global RegExp (expected: stable PASS)\nopts: {\"allowedAud\":{}}\nPASS=12 FAIL=0\nsequence: PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS\n\n[+] Wrote JSON evidence: C:\\Users\\Franciny Rojas\\Desktop\\crypto-research\\fast-jwt\\evidence-regex-stateful-fastjwt.json\n[+] Wrote LOG evidence : C:\\Users\\Franciny Rojas\\Desktop\\crypto-research\\fast-jwt\\evidence-regex-stateful-fastjwt.log\nPS C:\\Users\\Franciny Rojas\\Desktop\\crypto-research\\fast-jwt>",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fast-jwt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nearform/fast-jwt/security/advisories/GHSA-3j8v-cgw4-2g6q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-35040"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nearform/fast-jwt/pull/593"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nearform/fast-jwt/commit/18d25904e4617e8753526d1b3ab5a2cccdea726a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nearform/fast-jwt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nearform/fast-jwt/releases/tag/v6.2.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-440", "CWE-697" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-09T16:41:20Z",
    "nvd_published_at" : "2026-04-09T16:16:27Z"
  }
}