CVE-2024-52798: Path to regexp Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-rhx6-c78j-4q9w
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2024-52798 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Path to regexp libraries in the npm ecosystem. The issue involves path-to-regexp contains a redos. Remediation is available by upgrading affected packages to version 0.1.12.

CVE-2024-52798 at a Glance

CVE Identifier CVE-2024-52798
GHSA Identifier GHSA-rhx6-c78j-4q9w
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Path to regexp
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-52798

To remediate this vulnerability, upgrade all affected Path to regexp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

path-to-regexp fixed: 0.1.12
npm install path-to-regexp@0.1.12
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls path-to-regexp

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-52798, inspect your project dependencies using npm:

npm ls path-to-regexp

Analyze the terminal output to locate any version of Path to regexp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.12), your application is affected.

Note: The npm ls path-to-regexp command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Path to regexp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 - https://github.com/advisories/GHSA-9wv6-86v2-598j - https://blakeembrey.com/posts/2024-09-web-redos/

CVE-2024-52798 Affected Path to regexp Versions

1 component(s)
Fixed Versions:
0.1.12
Product / Package Ecosystem Affected Versions Fixed Version
path-to-regexp
npm
< 0.1.12
0.1.12

References

Frequently Asked Questions

What is CVE-2024-52798?
CVE-2024-52798 is a security vulnerability in Path to regexp involving path-to-regexp contains a ReDoS under CWE-1333: Inefficient Regular Expression Complexity.
Which Path to regexp versions are affected?
Affected versions include releases prior to 0.1.12 across affected packages: path-to-regexp.
What version fixes CVE-2024-52798?
Upgrading to 0.1.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is path-to-regexp affected?
Yes, path-to-regexp is affected in releases prior to 0.1.12. Upgrade your dependency to 0.1.12 or later.
What is the CVSS score of CVE-2024-52798?
CVE-2024-52798 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-52798?
CVE-2024-52798 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2024-52798?
Run the dependency tree command: 'npm ls path-to-regexp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rhx6-c78j-4q9w",
  "modified" : "2025-06-03T14:30:56Z",
  "published" : "2024-12-05T22:40:47Z",
  "aliases" : [ "CVE-2024-52798" ],
  "summary" : "path-to-regexp contains a ReDoS",
  "details" : "### Impact\n\nThe 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\n\n### Patches\n\nUpgrade to 0.1.12.\n\n### Workarounds\n\nAvoid 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.\n\n### References\n\n- https://github.com/advisories/GHSA-9wv6-86v2-598j\n- https://blakeembrey.com/posts/2024-09-web-redos/",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "path-to-regexp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.12"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-rhx6-c78j-4q9w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-52798"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pillarjs/path-to-regexp/commit/f01c26a013b1889f0c217c643964513acf17f6a4"
  }, {
    "type" : "WEB",
    "url" : "https://blakeembrey.com/posts/2024-09-web-redos"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pillarjs/path-to-regexp"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20250124-0002"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-05T22:40:47Z",
    "nvd_published_at" : "2024-12-05T23:15:06Z"
  }
}