Staging Environment: Content and features may be unstable or change without notice.
Search for packages
Package details: pkg:npm/path-to-regexp@0.1.4
purl pkg:npm/path-to-regexp@0.1.4
Next non-vulnerable version 0.1.12
Latest non-vulnerable version 8.4.0
Risk 4.0
Vulnerabilities affecting this package (2)
Vulnerability Summary Fixed by
VCID-2xgj-yjdf-nqeh
Aliases:
CVE-2024-52798
GHSA-rhx6-c78j-4q9w
path-to-regexp contains a ReDoS ### 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/
0.1.12
Affected by 0 other vulnerabilities.
0.2.0
Affected by 1 other vulnerability.
VCID-r95c-k4nq-jbd1
Aliases:
CVE-2024-45296
GHSA-9wv6-86v2-598j
path-to-regexp outputs backtracking regular expressions ### 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: - [0.1.10](https://github.com/pillarjs/path-to-regexp/releases/tag/v0.1.10) - [1.9.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v1.9.0) - [3.3.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v3.3.0) - [6.3.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v6.3.0) 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](https://github.com/pillarjs/path-to-regexp/releases/tag/v7.1.0) can enable `strict: true` and get an error when the regular expression might be bad. Version [8.0.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v8.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](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) 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 * [OWASP](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) * [Detailed blog post](https://blakeembrey.com/posts/2024-09-web-redos/)
0.1.10
Affected by 1 other vulnerability.
1.9.0
Affected by 0 other vulnerabilities.
2.0.0
Affected by 1 other vulnerability.
3.3.0
Affected by 0 other vulnerabilities.
4.0.0
Affected by 1 other vulnerability.
6.3.0
Affected by 0 other vulnerabilities.
7.0.0
Affected by 1 other vulnerability.
8.0.0
Affected by 2 other vulnerabilities.
Vulnerabilities fixed by this package (0)
Vulnerability Summary Aliases
This package is not known to fix vulnerabilities.

Date Actor Action Vulnerability Source VulnerableCode Version
2026-04-16T23:16:24.555415+00:00 GitLab Importer Affected by VCID-2xgj-yjdf-nqeh https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-52798.yml 38.4.0
2026-04-16T23:07:41.435295+00:00 GitLab Importer Affected by VCID-r95c-k4nq-jbd1 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-45296.yml 38.4.0
2026-04-16T03:11:08.763539+00:00 GHSA Importer Affected by VCID-r95c-k4nq-jbd1 https://github.com/advisories/GHSA-9wv6-86v2-598j 38.4.0
2026-04-12T00:35:07.091835+00:00 GitLab Importer Affected by VCID-2xgj-yjdf-nqeh https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-52798.yml 38.3.0
2026-04-12T00:25:49.330717+00:00 GitLab Importer Affected by VCID-r95c-k4nq-jbd1 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-45296.yml 38.3.0
2026-04-11T14:39:55.061911+00:00 GHSA Importer Affected by VCID-r95c-k4nq-jbd1 https://github.com/advisories/GHSA-9wv6-86v2-598j 38.3.0
2026-04-03T00:42:53.687095+00:00 GitLab Importer Affected by VCID-2xgj-yjdf-nqeh https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-52798.yml 38.1.0
2026-04-03T00:33:27.745786+00:00 GitLab Importer Affected by VCID-r95c-k4nq-jbd1 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/npm/path-to-regexp/CVE-2024-45296.yml 38.1.0
2026-04-02T15:20:35.735507+00:00 GHSA Importer Affected by VCID-r95c-k4nq-jbd1 https://github.com/advisories/GHSA-9wv6-86v2-598j 38.1.0