CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-35041

CVE-2026-35041: Regular Expression Denial of Service in fast-jwt

Alon Barad
Alon Barad
Software Engineer

Apr 9, 2026·5 min read·39 visits

Executive Summary (TL;DR)

fast-jwt versions prior to 6.2.1 are vulnerable to ReDoS during token claim validation. An attacker with a validly signed token can supply a maliciously crafted claim to exhaust CPU resources, causing a complete denial of service for the affected Node.js process.

A Regular Expression Denial of Service (ReDoS) vulnerability exists in the fast-jwt Node.js library. Versions 5.0.0 through 6.2.0 fail to validate the complexity of developer-supplied regular expressions used for JSON Web Token claim validation. This allows attackers possessing a validly signed token to trigger catastrophic backtracking in the JavaScript engine, blocking the Node.js event loop and causing a denial of service.

Vulnerability Overview

fast-jwt is a Node.js library responsible for signing and verifying JSON Web Tokens. The library supports customizable validation for specific JWT claims, such as aud (audience) and iss (issuer). This design allows developers to supply standard JavaScript RegExp objects for dynamic pattern matching during the token verification phase.

A Regular Expression Denial of Service (ReDoS) vulnerability, tracked as CWE-1333, exists in this claim verification logic. Versions 5.0.0 through 6.2.0 of fast-jwt do not validate the complexity or safety of the developer-supplied regular expressions prior to execution. The library implicitly trusts the configuration provided by the application owner.

This design oversight allows the underlying JavaScript V8 engine to attempt exponential evaluations when processing specific token claims against vulnerable patterns. The resulting evaluation blocks the main event loop, causing immediate degradation of service and subsequent application unavailability.

Root Cause Analysis

The defect stems from the lack of input sanitization on developer-supplied RegExp patterns passed into the token verifier configuration. Options such as allowedAud, allowedIss, allowedSub, allowedJti, and allowedNonce accept these expressions to validate token claims dynamically.

When a regular expression contains grouping with repetition, such as /(a+)+X$/, the regex engine utilizes a nondeterministic finite automaton (NFA) approach to evaluate matches. If the token claim contains a payload that partially matches the expression but ultimately fails to meet the termination condition, the engine attempts every possible permutation of the repetitive sequence.

This mechanism is known as catastrophic backtracking. Because Node.js runs on a single-threaded event loop, the excessive computational overhead from backtracking blocks all concurrent operations. The execution context remains trapped within the regex evaluation routine until the maximum stack depth is reached or the engine exhausts available resources.

Code Analysis

Prior to version 6.2.1, the library blindly executed regex.test(claimValue) without analyzing the internal structure of the RegExp object. This implementation placed the burden of regex safety entirely on the application developer, providing no failsafe against overly complex patterns.

The patch introduced in commit b0be0ca161593836a153d5180ca5358ad9b5de94 resolves this defect by integrating the safe-regex2 package. The maintainers implemented a checkForUnsafeRegExp helper function invoked during the initialization of the token verifier.

// Patched code from src/verifier.js
const safeRegex = require('safe-regex2')
 
function checkForUnsafeRegExp(raw, optionName) {
  const patterns = Array.isArray(raw) ? raw : [raw]
  for (const r of patterns) {
    if (r instanceof RegExp && !safeRegex(r)) {
      process.emitWarning(
        `The ${optionName} option contains an unsafe RegExp ${r} that may cause a ReDoS attack. Please review it. ` +
          'See https://github.com/nearform/fast-jwt/security/advisories/GHSA-cjw9-ghj4-fwxf for details.',
        { code: 'FAST_JWT_UNSAFE_REGEXP' }
      )
    }
  }
}

Additionally, commit 18d25904e4617e8753526d1b3ab5a2cccdea726a mitigates a separate statefulness vulnerability by resetting r.lastIndex = 0 prior to every test execution. This modification ensures that regex objects initialized with the /g or /y flags do not persist state across multiple validation invocations, guaranteeing deterministic evaluation.

Exploitation

Exploitation of this vulnerability requires specific environmental prerequisites. The targeted application must actively utilize fast-jwt and must initialize the verifier with a vulnerable regular expression for at least one claim property. The attacker cannot inject the regex pattern; they can only supply the input evaluated against it.

The attacker must supply a JWT containing a maliciously crafted claim string that triggers the catastrophic backtracking scenario. Because the regex evaluation occurs strictly after the cryptographic signature of the token is verified, the attacker must possess a token that the server considers cryptographically valid.

This valid token must either be generated by a trusted issuer or signed using a compromised cryptographic key. Once the application receives the token, the V8 engine evaluates the crafted claim against the unsafe pattern, immediately causing the CPU core to spike to 100% utilization. The Node.js instance subsequently stops processing new incoming HTTP requests.

Impact Assessment

The primary security impact is a localized Denial of Service (DoS) resulting in the complete unavailability of the affected Node.js process. Because JavaScript execution is single-threaded, a single malicious JWT renders the entire process unresponsive to all users sharing that instance.

The vulnerability holds a CVSS v3.1 base score of 4.2. The metric reflects a High Attack Complexity (AC:H) because the application must be misconfigured with an unsafe regex. It also factors in High Privileges Required (PR:H) because the payload must reside within a validly signed token.

Despite the low numerical score, the operational impact on microservice architectures can be severe. In deployments lacking robust health checking and auto-remediation, a single malicious request permanently disables the service pod. The vulnerability does not permit data exfiltration, memory corruption, or remote code execution.

Remediation

The primary remediation strategy requires upgrading the fast-jwt dependency to version 6.2.1 or later. The patched version enforces static analysis of all provided regular expressions and logs explicit process warnings when developers supply unsafe patterns during verifier initialization.

Software engineering teams must audit their usage of the createVerifier function. Developers should replace complex RegExp objects with strict string equality checks or simple prefix validations whenever the business logic permits. Avoiding regex entirely for standard claims eliminates the attack surface.

If regular expressions remain a strict requirement, teams must implement CI/CD checks utilizing tools like eslint-plugin-regexp or safe-regex2 to identify and reject catastrophic backtracking patterns before deployment. Active runtime monitoring should also capture and alert on the FAST_JWT_UNSAFE_REGEXP warning code to identify flawed configurations in production.

Official Patches

nearformPatch commit integrating safe-regex2
nearformFast-JWT v6.2.1 Release Notes

Fix Analysis (2)

Technical Appendix

CVSS Score
4.2/ 10
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:H

Affected Systems

Node.js applications using fast-jwtMicroservices implementing custom JWT claim validation logic via regex

Affected Versions Detail

Product
Affected Versions
Fixed Version
fast-jwt
nearform
>= 5.0.0, <= 6.2.06.2.1
AttributeDetail
CWE IDCWE-1333
Attack VectorNetwork
CVSS v3.14.2 (Medium)
ImpactDenial of Service (CPU Exhaustion)
Exploit StatusProof of Concept
Vulnerable Componentfast-jwt Verifier Configuration

MITRE ATT&CK Mapping

T1499.003Endpoint Denial of Service: OS Exhaustion
Impact
CWE-1333
Inefficient Regular Expression Complexity

The software uses a regular expression that requires exponential time to evaluate, causing a denial of service.

Known Exploits & Detection

GitHub Security AdvisoryOfficial advisory documenting the required conditions for the proof of concept.

Vulnerability Timeline

Initial disclosure and publication of GitHub Advisory (GHSA-cjw9-ghj4-fwxf).
2026-04-09
Vulnerability fixed in version 6.2.1.
2026-04-09
CVE-2026-35041 published to the NVD.
2026-04-09

References & Sources

  • [1]GitHub Security Advisory (GHSA-cjw9-ghj4-fwxf)
  • [2]NVD CVE Record for CVE-2026-35041
Related Vulnerabilities
CVE-2026-35040

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 5 hours ago•CVE-2026-53634
4.3

CVE-2026-53634: Missing Authorization in Code16 Sharp Quick Creation Command Controller

Code16 Sharp versions from 9.0.0 up to (but not including) 9.22.3 are vulnerable to a missing authorization flaw in the Quick Creation Command feature. The ApiEntityListQuickCreationCommandController fails to validate entity-level 'create' policies before returning administrative form designs or processing database modifications. Authenticated users with restricted access can bypass policy boundaries to access creation configurations and insert records.

Alon Barad
Alon Barad
5 views•5 min read
•about 6 hours ago•CVE-2026-49471
8.3

CVE-2026-49471: Unauthenticated Remote Code Execution in Serena MCP Toolkit via DNS Rebinding and Memory Poisoning

CVE-2026-49471 is a high-severity security vulnerability in Serena, an AI-assisted coding Model Context Protocol (MCP) toolkit. In versions prior to v1.5.2, Serena's built-in web dashboard exposes an unauthenticated Flask API on a predictable port. Lacking host validation and CSRF protections, this endpoint is vulnerable to DNS Rebinding. An attacker can lure a user to a malicious webpage, bypass the Same-Origin Policy (SOP), rewrite the AI agent's persistent memory, and execute arbitrary commands on the host operating system via the autonomous agent's shell execution engine.

Alon Barad
Alon Barad
8 views•5 min read
•about 6 hours ago•GHSA-MXWC-WH95-PW4G
5.3

GHSA-MXWC-WH95-PW4G: Denial of Service via Uncontrolled Recursion in Trapster DNS Parser

The trapster honeypot package is vulnerable to a remote denial of service (DoS) vulnerability due to uncontrolled recursion during the parsing of malformed DNS compression pointers in the decode_labels function.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 7 hours ago•GHSA-Q95X-7G78-RCCV
6.3

GHSA-Q95X-7G78-RCCV: Safe Rust Memory Corruption via Use-After-Free in oneringbuf Crate

A critical Use-After-Free (UAF) memory corruption vulnerability exists in the oneringbuf Rust crate prior to version 0.8.0. The vulnerability allows safe Rust code to instantiate and clone reference wrappers that point to heap-allocated ring buffers. Dropping one wrapper prematurely reclaims the backing memory, leading to dangling pointer references and subsequent Use-After-Free or Double Free states.

Amit Schendel
Amit Schendel
6 views•7 min read
•about 20 hours ago•CVE-2026-53359
8.8

CVE-2026-53359: Use-After-Free in Linux Kernel KVM Shadow MMU (Januscape)

Januscape (CVE-2026-53359) is a critical Use-After-Free vulnerability in the x86 Shadow MMU component of the Linux Kernel's KVM subsystem. A logic error in shadow page tracking permits unauthorized page reuse without validating architectural execution roles, leading to dangling pointers in reverse mapping (rmap) tracking entries during guest memory teardown.

Amit Schendel
Amit Schendel
85 views•5 min read
•about 20 hours ago•CVE-2026-48282
10.0

CVE-2026-48282: Unauthenticated Path Traversal and Arbitrary File Write in Adobe ColdFusion Remote Development Services

CVE-2026-48282 is a critical unauthenticated path traversal and arbitrary file write vulnerability in the Remote Development Services (RDS) component of Adobe ColdFusion. The vulnerability allows a remote, unauthenticated attacker to bypass directory boundaries and write arbitrary files, including CFML-based web shells, onto the host server. This flaw is actively exploited in the wild and enables full unauthenticated remote code execution under the privileges of the ColdFusion service account.

Alon Barad
Alon Barad
41 views•6 min read