Skip to content
Heist/ feed
Back to feed
Medium

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

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-35040
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 03:38 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 9 Apr 2026, 14:52 UTC

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.

osv:CVE-2026-35040
Complete source record
{
  "id": "2c6182d58b3c5993ff3a56f44108b9b5f56bfb9a3044ef582a63df874dfd5ce3",
  "url": "https://osv.dev/vulnerability/CVE-2026-35040",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "fast-jwt: Stateful RegExp (/g or /y) causes non-deterministic allowed-claim validation (logical DoS)",
    "summary": "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.",
    "evidence": "osv:CVE-2026-35040",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-35040",
      "aliases": [
        "CVE-2026-35040",
        "GHSA-3j8v-cgw4-2g6q"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/nearform/fast-jwt",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "6b13fe96614a38613d453f46ba0631c4cd09dcd8"
                },
                {
                  "fixed": "18d25904e4617e8753526d1b3ab5a2cccdea726a"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:nearform:fast-jwt:*:*:*:*:*:node.js:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "6.2.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "18d25904e4617e8753526d1b3ab5a2cccdea726a"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "6b13fe96614a38613d453f46ba0631c4cd09dcd8"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v6.2.1"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v6.2.0",
            "v6.1.0",
            "v2.0.0",
            "v1.7.2",
            "v1.7.1",
            "v1.7.0",
            "v1.6.1",
            "v1.6.0",
            "v1.5.4",
            "v1.5.3",
            "v1.5.2",
            "v1.5.1",
            "v1.5.0",
            "v1.4.1",
            "v1.4.0",
            "v1.3.2",
            "v1.3.0",
            "v1.2.0",
            "v1.1.3",
            "v1.1.2",
            "v1.1.1",
            "v1.1.0",
            "v1.0.0",
            "v0.5.1",
            "v0.5.0",
            "v0.4.2",
            "v0.4.1",
            "v0.4.0",
            "v0.3.1",
            "v0.3.0",
            "v0.2.0",
            "v0.1.1",
            "v0.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-35040.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:49.405493825Z",
      "provider": "osv",
      "references": [
        "https://github.com/nearform/fast-jwt/releases/tag/v6.2.1",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/35xxx/CVE-2026-35040.json",
        "https://github.com/nearform/fast-jwt/security/advisories/GHSA-3j8v-cgw4-2g6q",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-35040",
        "https://github.com/nearform/fast-jwt/commit/18d25904e4617e8753526d1b3ab5a2cccdea726a",
        "https://github.com/nearform/fast-jwt/pull/593"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-440",
          "CWE-697"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/35xxx/CVE-2026-35040.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-35040",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 517819,
  "published_at": "2026-04-09T14:52:56.436+00:00"
}