CVE-2026-35040: fast-jwt: Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS)
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
References
- github.com/advisories/GHSA-3j8v-cgw4-2g6q
- github.com/nearform/fast-jwt
- github.com/nearform/fast-jwt/commit/18d25904e4617e8753526d1b3ab5a2cccdea726a
- github.com/nearform/fast-jwt/pull/593
- github.com/nearform/fast-jwt/releases/tag/v6.2.1
- github.com/nearform/fast-jwt/security/advisories/GHSA-3j8v-cgw4-2g6q
- nvd.nist.gov/vuln/detail/CVE-2026-35040
Code Behaviors & Features
Detect and mitigate CVE-2026-35040 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →