CVE-2024-52798: path-to-regexp ReDoS vulnerability

CVE-2024-52798 · Severity: low · CVSS 3.1 · Published 2024-12-05

path-to-regexp is a popular JavaScript library used to convert URL path strings into regular expressions for routing in web applications. A regular expression denial-of-service (ReDoS) vulnerability allows attackers to send specially crafted path patterns that cause excessive CPU consumption, potentially making the application unresponsive or unavailable to legitimate users.

Technologies: path-to-regexp (npm). Vendors: npm.

Quick answers

Is CVE-2024-52798 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2024-52798 being exploited in the wild.
How severe is CVE-2024-52798?
Low severity, with a CVSS score of 3.1, published 5 December 2024.
Which products and versions are affected?
path-to-regexp (npm) SEMVER:introduced=0,fixed=0.1.12.
Is there a fix for CVE-2024-52798?
Yes. path-to-regexp (npm): upgrade to 0.1.12 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2024-52798 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2024-52798?
Check whether you run path-to-regexp (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • path-to-regexp (npm): upgrade to 0.1.12 or later
    npm install path-to-regexp@0.1.12

Technical details

The vulnerability is a Regular Expression Denial of Service (ReDoS) in the regular expression generation logic of path-to-regexp versions before 0.1.12. The vulnerable code can be triggered when two parameters are used within a single path segment with a separator that is not a dot (e.g., /:a-:b), which generates a regex susceptible to catastrophic backtracking. An attacker with network access can provide a crafted path pattern that causes exponential time complexity in regex matching, consuming excessive CPU resources. The vulnerability requires no authentication or user interaction and has high availability impact. The fix is available in version 0.1.12, which addresses the regex pattern generation to prevent backtracking scenarios.

Affected products

  • pillarjs path-to-regexp <0.1.12

Identifiers

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

Timeline

  • 2024-12-05: disclosed: GHSA-rhx6-c78j-4q9w advisory published
  • 2024-12-05: patched: Version 0.1.12 released with fix

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.