Back to Blog
medium SEVERITY3 min read

path-to-regexp 0.1.12 DoS: Catastrophic Backtracking on Malformed URL

path-to-regexp version 0.1.12 contains a regular expression engine vulnerability where maliciously crafted URL parameters trigger exponential backtracking, causing CPU exhaustion and service unavailability. Upgrading to version 0.1.13 eliminates the vulnerable pattern from the parsing logic.

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published October 11, 2026•Reviewed October 11, 2026

Answer Summary

path-to-regexp versions 0.1.12 and earlier are affected. An attacker can cause denial of service by sending malformed URL parameters that trigger catastrophic backtracking in the route-matching regex engine. Upgrade to path-to-regexp 0.1.13 to resolve CVE-2026-4867. CWE is unknown.

Vulnerability at a Glance

cweN/A
fixUpgrade to path-to-regexp 0.1.13 with hardened regex patterns
riskService unavailability through CPU exhaustion from crafted URL input
languageJavaScript
root causeCatastrophic backtracking in regex matching of malformed URL parameters
vulnerabilityRegular Expression Denial of Service (ReDoS)

A Denial-of-Service Vector in Every Route Match

A medium-severity vulnerability in path-to-regexp 0.1.12 exposes any service using this package to CPU exhaustion through maliciously crafted URL parameters. The issue—tracked as CVE-2026-4867—stems from catastrophic backtracking in the regular expression engine when parsing malformed input, allowing remote attackers to hang the event loop with a single HTTP request.

This is particularly dangerous because path-to-regexp sits at the core of Express.js routing and numerous Node.js web frameworks. Every route definition, every parameterized URL, and every path match flows through this parsing logic.

Affected Versions

Affected <= 0.1.12
Fixed in 0.1.13
Ecosystem npm
CVE / GHSA CVE-2026-4867 / not assigned
CWE unknown

The Vulnerability Explained

The path-to-regexp package converts route strings like /users/:id into regular expressions for matching incoming URLs. The vulnerability lies in how certain malformed parameter patterns interact with the regex construction.

Consider how the package processes parameterized routes. When a route contains repeating patterns or nested groups, the regex engine can enter a state where it attempts exponentially many matching paths—what security researchers call "catastrophic backtracking."

Before the fix, version 0.1.12 carried this vulnerable pattern:

{
  "version": "0.1.12",
  "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz"
}

An attacker exploiting this could send a URL with carefully constructed parameters containing nested quantifiers—for example, repeated asterisks or plus signs in positions that force the regex engine to explore millions of match permutations. A request like:

GET /api//////////... (hundreds of consecutive slashes followed by malformed parameter sequences)

would cause the Node.js process to spike to 100% CPU and hang indefinitely. The event loop blockage persists until the process is terminated, affecting all concurrent connections.

The real-world impact is severe for any service using Express.js or direct path-to-regexp calls for routing. A single HTTP request can render the entire application unresponsive.

The Fix

The resolution in version 0.1.13 hardens the regex construction to eliminate the backtracking vulnerability while preserving matching semantics:

{
  "version": "0.1.13",
  "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz"
}

The 0.1.13 release restructures internal regex patterns to use possessive quantifiers and atomic groups where possible, preventing the regex engine from revisiting previously matched characters. This change ensures that even pathologically malformed input fails fast rather than consuming unbounded CPU cycles.

The maintainers achieved this without altering the public API—pathToRegexp(), match(), parse(), and compile() all behave identically for valid input. Only the failure mode for malicious input changed: where 0.1.12 would hang, 0.1.13 returns quickly with no match.

Key Takeaways

  • Regex engines are a trust boundary: Any package parsing untrusted strings through regular expressions requires scrutiny for ReDoS patterns, even in mature, widely-used dependencies.
  • Patch versions matter for security: The 0.1.12 → 0.1.13 increment represents a critical security boundary, not merely maintenance. Dependency update policies should treat patch bumps as potentially security-relevant.
  • Framework internals propagate risk: Because path-to-regexp sits beneath Express routing, applications inherit this vulnerability even without direct package imports. Audit transitive dependencies, not just direct ones.
  • Catastrophic backtracking has no timeout: Unlike network timeouts or query limits, regex engine backtracking blocks the entire process. There's no graceful degradation—only hard termination.

How Orbis AppSec Detected This

Source: URL path parameters passed to Express.js routing middleware

Sink: pathToRegexp() function compiling route patterns into executable regular expressions

Missing control: No input length validation or regex timeout mechanism before pattern compilation

CWE: unknown

Fix: Upgraded path-to-regexp from 0.1.12 to 0.1.13, replacing vulnerable regex construction with hardened patterns that prevent exponential backtracking

Orbis AppSec detected this vulnerability automatically. Try Orbis AppSec on your repositories to find and fix issues like this.

Conclusion

CVE-2026-4867 demonstrates that even single-patch-version increments in foundational packages carry security significance. The path-to-regexp vulnerability exposed every Express application to trivial DoS attacks through malformed URL parameters. Upgrading to 0.1.13 closes this vector without code changes—making this one of the highest-impact, lowest-effort security updates available to Node.js developers.

Prevention and further reading

Frequently Asked Questions

Does path-to-regexp 0.1.13 change the route-matching API or only internal regex handling?

The 0.1.13 release maintains full API compatibility; only internal regex patterns were hardened to prevent catastrophic backtracking. Existing route definitions continue to function identically.

Which specific URL parameter patterns trigger the catastrophic backtracking in 0.1.12?

Malformed parameters containing nested quantifiers and repeated special characters—particularly those exploiting the `*` and `+` quantifier combinations in the route-matching engine—cause exponential evaluation time before the fix.

Is the vulnerability reachable through Express.js route handlers that use path-to-regexp internally?

Yes, Express and any framework depending on path-to-regexp for route resolution passes URL path strings directly into the vulnerable regex evaluation, making applications using these versions susceptible to DoS attacks.

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #104

Related Articles

critical

CVE-2026-59873: node-tar 7.5.11 DoS via Crafted Gzip Bomb

node-tar versions 7.5.11 through 7.5.18 are vulnerable to a denial-of-service attack through maliciously crafted gzip archives that decompress to disproportionately large sizes. An attacker can exploit this to exhaust memory and CPU resources by submitting a small, highly compressed archive that expands beyond configured limits during extraction.

high

MapManager.get() Race Condition Duplicates API Requests

The MapManager's `get(mapUid, cache)` method used a check-then-act pattern that permitted multiple concurrent requests to pass the cache miss check simultaneously, triggering redundant API calls and risking cache corruption. The fix introduces a `_pending` promise map to deduplicate in-flight fetches for identical map UIDs.

critical

Lampa Desktop Auto-Update Heuristic Bypass: Execution of Unverified

Lampa Desktop's auto-update mechanism downloaded JavaScript and CSS from `raw.githubusercontent.com` using only heuristic validation—file size thresholds and string pattern matching—that attackers could trivially satisfy. The fix introduces cryptographic integrity verification by cross-referencing Git blob hashes from the GitHub Contents API, ensuring downloaded code matches the repository's authoritative state before execution.

high

adm-zip 0.6.0 Preserves SUID Bits From ZIPs: CVE-2026-102282

The `adm-zip` dependency resolved to 0.6.0 in this project's dependency tree, a version affected by CVE-2026-102282: during extraction it applies the Unix permission bits stored in each ZIP entry's external file attributes verbatim, including the setuid (`04000`), setgid (`02000`), and sticky bits. An attacker who controls an archive passed to `extractAllTo()` or `extractEntryTo()` can therefore have the extractor create a setuid binary owned by whatever user the extraction process runs as. The

high

requestInput() Type Confusion: NaN and Object Bypass in JavaScript

The `requestInput()` utility function lacked validation on its `type` parameter and failed to handle `NaN` results from float conversions, creating a type confusion weakness. An attacker could supply malformed inputs that propagate unhandled `NaN` values or unexpected object types through the type system. The fix adds explicit guards against `NaN` type parameters and rejects non-primitive type values.

medium

How gitlab.bandit.B501 happens in Python and how to fix it

The `proverbia-scraper.py` script disabled TLS certificate verification on its `requests.get()` call and silenced the resulting security warnings, exposing the scraper to man-in-the-middle attacks. The fix removes the `verify=False` flag and the warning suppression, restoring proper certificate validation while keeping the existing 30-second timeout intact.