Vulnerability · Published Apr 9, 2026 · Assigned by GitHub_M
CVE-2026-35040fast-jwt: Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS)
Medium 5.3
In plain English
A medium-severity security flaw in fast-jwt from nearform. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 34% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| npm | fast-jwt | 6.2.1 | GHSA-3j8v-cgw4-2g6q |
Affected products (as reported)
Weakness: CWE-697, CWE-440 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
References
- https://github.com/nearform/fast-jwt/security/advisories/GHSA-3j8v-cgw4-2g6q x_refsource_CONFIRM
- https://github.com/nearform/fast-jwt/pull/593 x_refsource_MISC
- https://github.com/nearform/fast-jwt/commit/18d25904e4617e8753526d1b3ab5a2cccdea726a x_refsource_MISC
- https://github.com/nearform/fast-jwt/releases/tag/v6.2.1 x_refsource_MISC