Skip to content

fix(deps): update dependency path-to-regexp to v8 [security]#1492

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-path-to-regexp-vulnerability
Open

fix(deps): update dependency path-to-regexp to v8 [security]#1492
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-path-to-regexp-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Sep 10, 2024

This PR contains the following updates:

Package Change Age Confidence
path-to-regexp 7.1.08.0.0 age confidence

path-to-regexp outputs backtracking regular expressions

CVE-2024-45296 / GHSA-9wv6-86v2-598j

More information

Details

Impact

A bad regular expression is generated any time you have two parameters within a single segment, separated by something that is not a period (.). For example, /:a-:b.

Patches

For users of 0.1, upgrade to 0.1.10. All other users should upgrade to 8.0.0.

These versions add backtrack protection when a custom regex pattern is not provided:

They do not protect against vulnerable user supplied capture groups. Protecting against explicit user patterns is out of scope for old versions and not considered a vulnerability.

Version 7.1.0 can enable strict: true and get an error when the regular expression might be bad.

Version 8.0.0 removes the features that can cause a ReDoS.

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 to /:a-:b([^-/]+).

If paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length. For example, halving the attack string improves performance by 4x faster.

Details

Using /:a-:b will produce the regular expression /^\/([^\/]+?)-([^\/]+?)\/?$/. This can be exploited by a path such as /a${'-a'.repeat(8_000)}/a. OWASP has a good example of why this occurs, but the TL;DR is the /a at the end ensures this route would never match but due to naive backtracking it will still attempt every combination of the :a-:b on the repeated 8,000 -a.

Because JavaScript is single threaded and regex matching runs on the main thread, poor performance will block the event loop and can lead to a DoS. In local benchmarks, exploiting the unsafe regex will result in performance that is over 1000x worse than the safe regex. In a more realistic environment using Express v4 and 10 concurrent connections, this translated to average latency of ~600ms vs 1ms.

References

Severity

  • CVSS Score: 7.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


path-to-regexp contains a ReDoS

CVE-2024-52798 / GHSA-rhx6-c78j-4q9w

More information

Details

Impact

The regular expression that is vulnerable to backtracking can be generated in versions before 0.1.12 of path-to-regexp, originally reported in CVE-2024-45296

Patches

Upgrade to 0.1.12.

Workarounds

Avoid using two parameters within a single path segment, when the separator is not . (e.g. no /:a-:b). Alternatively, you can define the regex used for both parameters and ensure they do not overlap to allow backtracking.

References

Severity

  • CVSS Score: 7.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

pillarjs/path-to-regexp (path-to-regexp)

v8.0.0: Simpler API

Compare Source

Heads up! This is a fairly large change (again) and I need to apologize in advance. If I foresaw what this version would have ended up being I would not have released version 7. A longer blog post and explanation will be incoming this week, but the pivot has been due to work on Express.js v5 and this will the finalized syntax used in Express moving forward.

Edit: The post is out - https://blakeembrey.com/posts/2024-09-web-redos/

Added

  • Adds key names to wildcards using *name syntax, aligns with : behavior but using an asterisk instead

Changed

  • Removes group suffixes of ?, +, and * - only optional exists moving forward (use wildcards for +, {*foo} for *)
  • Parameter names follow JS identifier rules and allow unicode characters

Added

  • Parameter names can now be quoted, e.g. :"foo-bar"
  • Match accepts an array of values, so the signature is now string | TokenData | Array<string | TokenData>

Removed

  • Removes loose mode
  • Removes regular expression overrides of parameters

v7.2.0: Support array inputs (again)

Compare Source

Added

  • Support array inputs for match and pathToRegexp 3fdd88f

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Sep 10, 2024

Deploying node-js-server with  Cloudflare Pages  Cloudflare Pages

Latest commit: d4cf800
Status: ✅  Deploy successful!
Preview URL: https://d58fff45.node-js-server.pages.dev
Branch Preview URL: https://renovate-npm-path-to-regexp.node-js-server.pages.dev

View logs

@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed Sep 11, 2024
@renovate renovate Bot closed this Sep 11, 2024
@renovate renovate Bot deleted the renovate/npm-path-to-regexp-vulnerability branch September 11, 2024 18:07
@renovate renovate Bot restored the renovate/npm-path-to-regexp-vulnerability branch September 11, 2024 21:50
@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed fix(deps): update dependency path-to-regexp to v8 [security] Sep 11, 2024
@renovate renovate Bot reopened this Sep 11, 2024
@renovate renovate Bot force-pushed the renovate/npm-path-to-regexp-vulnerability branch from 4225ef6 to 8cc5aa6 Compare September 11, 2024 21:50
@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate renovate Bot deleted the renovate/npm-path-to-regexp-vulnerability branch March 27, 2026 01:48
@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed fix(deps): update dependency path-to-regexp to v8 [security] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate renovate Bot force-pushed the renovate/npm-path-to-regexp-vulnerability branch 2 times, most recently from 8cc5aa6 to 3f86f65 Compare March 30, 2026 21:27
@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot changed the title fix(deps): update dependency path-to-regexp to v8 [security] - autoclosed fix(deps): update dependency path-to-regexp to v8 [security] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate renovate Bot force-pushed the renovate/npm-path-to-regexp-vulnerability branch 2 times, most recently from 3f86f65 to d4cf800 Compare April 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants