CVE-2026-4867: path-to-regexp vulnerable to Regular Expression Denial of Service via multiple route parameters

Published Mar 26, 2026
·
Updated

Impact

A bad regular expression is generated any time you have three or more parameters within a single segment, separated by something that is not a period (.). For example, /:a-:b-:c or /:a-:b-:c-:d. The backtrack protection added in path-to-regexp@0.1.12 only prevents ambiguity for two parameters. With three or more, the generated lookahead does not block single separator characters, so capture groups overlap and cause catastrophic backtracking.

Patches

Upgrade to path-to-regexp@0.1.13

Custom regex patterns in route definitions (e.g., /:a-:b([^-/]+)-:c([^-/]+)) are not affected because they override the default capture group.

Workarounds

All versions can be patched by providing a custom regular expression for parameters after the first in a single segment. As long as the custom regular expression does not match the text before the parameter, you will be safe. For example, change /:a-:b-:c to /:a-:b([^-/]+)-:c([^-/]+).

If paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length.

References

- GHSA-9wv6-86v2-598j - Detailed blog post: ReDoS the web

Other sources

Impact:

A bad regular expression is generated any time you have three or more parameters within a single segment, separated by something that is not a period (.). For example, /:a-:b-:c or /:a-:b-:c-:d. The backtrack protection added in path-to-regexp@0.1.12 only prevents ambiguity for two parameters. With three or more, the generated lookahead does not block single separator characters, so capture groups overlap and cause catastrophic backtracking.

Patches:

Upgrade to path-to-regexp@0.1.13

Custom regex patterns in route definitions (e.g., /:a-:b([^-/]+)-:c([^-/]+)) are not affected because they override the default capture group.

Workarounds:

All versions can be patched by providing a custom regular expression for parameters after the first in a single segment. As long as the custom regular expression does not match the text before the parameter, you will be safe. For example, change /:a-:b-:c to /:a-:b([^-/]+)-:c([^-/]+).

If paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length.

NVD

Affected Software

4 affected componentsFixes available
npm/path-to-regexp<=0.1.12
npm/path-to-regexp<0.1.13
0.1.13
pillarjs Path-to-regexp Node.js<0.1.13
IBM watsonx.data intelligence<=5.2.2, 5.3.0, 5.3.1, 5.3.1-patch-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/path-to-regexp to a version that resolves this vulnerability.

    Fixed in 0.1.13
  2. Upgrade

    Upgrade path-to-regexp to a version that resolves this vulnerability.

    Fixed in 0.1.13
  3. Configuration

    For routes that have three or more parameters in a single segment separated by something other than a period (.), rewrite the route pattern so that parameters after the first use custom capture regexes that override the default capture group (e.g., change '/:a-:b-:c' to '/:a-:b([^-/]+)-:c([^-/]+)'). Ensure the custom regex does not match the text before the parameter.

    path-to-regexp route definitions parameter capture regex = Use custom regex for parameters after the first (e.g., change /:a-:b-:c to /:a-:b([^-/]+)-:c([^-/]+))
  4. Compensating control

    If paths cannot be rewritten and the vulnerable version cannot be upgraded, limit the URL length.

Event History

Mar 26, 2026
CVE Published
via MITRE·04:16 PM
Data Sourced
via MITRE·04:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:16 PM
Affected Software
Mar 27, 2026
Advisory Published
via GitHub·08:04 PM
Data Sourced
via GitHub·08:04 PM
DescriptionSeverityWeaknessAffected Software
Jun 24, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-4867?

CVE-2026-4867 has a medium severity level due to its potential for causing Regular Expression Denial of Service.

2

How do I fix CVE-2026-4867?

To fix CVE-2026-4867, update the path-to-regexp package to version 0.1.13 or later.

3

What causes CVE-2026-4867?

CVE-2026-4867 is caused by the generation of a bad regular expression when using three or more parameters in a single segment.

4

Which versions are affected by CVE-2026-4867?

Versions of path-to-regexp up to and including 0.1.12 are affected by CVE-2026-4867.

5

What is Regular Expression Denial of Service in CVE-2026-4867?

Regular Expression Denial of Service in CVE-2026-4867 occurs when complex regular expressions lead to excessive computation time, potentially slowing down or crashing applications.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203