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

Published Sep 9, 2024
·
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.

— MITRE

path-to-regexp turns path strings into a regular expressions. In certain cases, path-to-regexp will output a regular expression that can be exploited to cause poor performance. Because JavaScript is single threaded and regex matching runs on the main thread, poor performance will block the event loop and lead to a DoS. The bad regular expression is generated any time you have two parameters within a single segment, separated by something that is not a period (.). For users of 0.1, upgrade to 0.1.10. All other users should upgrade to 8.0.0.

— OSV

Affected Software

5 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 SevOne Network Performance Management<=7.0.0 - 8.2.2
debian/node-path-to-regexp
1.0.1-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 debian/node-path-to-regexp to a version that resolves this vulnerability.

    Fixed in 1.0.1-1
  3. Upgrade

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

    Fixed in 0.1.13
  4. Upgrade

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

    Fixed in 8.0.0
  5. Configuration

    Add custom regular expressions to parameters after the first in a segment; for example, change `/:a-:b-:c` to `/:a-:b([^-/]+)-:c([^-/]+)`. Ensure the custom expression does not match text before its parameter.

    path-to-regexp route definitions custom regular expressions for parameters after the first in a single segment = ([^-/]+)
  6. Compensating control

    If paths cannot be rewritten and versions cannot be upgraded, limit URL length.

Event History

Sep 9, 2024
CVE Published
via OSV·07:07 PM
Data Sourced
via OSV·07:07 PM
DescriptionSeverityWeakness
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
Mar 27, 2026
Advisory Published
via GitHub·08:04 PM
Data Sourced
via GitHub·08:04 PM
DescriptionSeverityWeaknessAffected Software
Apr 1, 2026
Event
via FIRST·12:00 AM
Apr 16, 2026
Data Sourced
via NVD·06:01 PM
Affected Software
Jun 24, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Sep 11, 2026
Updated
via IBM·12:00 AM
Affected Software
Sep 26, 2026
Updated
via IBM·12:00 AM
Affected Software

Parent advisories

This vulnerability appears in the following advisories.

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