{"id":"CVE-2024-45296","aliases":["CVE-2024-45296","GHSA-37ch-88jc-xwx2","GHSA-9wv6-86v2-598j"],"related":["CVE-2026-4867"],"kind":"vulnerability","state":"published","title":"path-to-regexp outputs backtracking regular expressions","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nA 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.\n\n### Patches\n\nUpgrade to [path-to-regexp@0.1.13](https://github.com/pillarjs/path-to-regexp/releases/tag/v.0.1.13)\n\nCustom regex patterns in route definitions (e.g., `/:a-:b([^-/]+)-:c([^-/]+)`) are not affected because they override the default capture group.\n\n### Workarounds\n\nAll 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([^-/]+)`.\n\nIf paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length.\n\n### References\n\n- [GHSA-9wv6-86v2-598j](https://github.com/advisories/GHSA-9wv6-86v2-598j)\n- [Detailed blog post: ReDoS the web](https://blakeembrey.com/posts/2024-09-web-redos/)","format":"markdown","source":"ghsa"},{"lang":"en","text":"### Impact\n\nA 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`.\n\n### Patches\n\nFor users of 0.1, upgrade to `0.1.10`. All other users should upgrade to `8.0.0`.\n\nThese versions add backtrack protection when a custom regex pattern is not provided:\n\n- [0.1.10](https://github.com/pillarjs/path-to-regexp/releases/tag/v0.1.10)\n- [1.9.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v1.9.0)\n- [3.3.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v3.3.0)\n- [6.3.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v6.3.0)\n\nThey 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.\n\nVersion [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.\n\nVersion [8.0.0](https://github.com/pillarjs/path-to-regexp/releases/tag/v8.0.0) removes the features that can cause a ReDoS.\n\n### Workarounds\n\nAll 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([^-/]+)`.\n\nIf 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.\n\n### Details\n\nUsing `/: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`.\n\nBecause 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.\n\n### References\n\n* [OWASP](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS)\n* [Detailed blog post](https://blakeembrey.com/posts/2024-09-web-redos/)","format":"markdown","source":"ghsa"},{"lang":"es","text":"path-to-regexp convierte cadenas de ruta en expresiones regulares. En ciertos casos, path-to-regexp generará una expresión regular que puede explotarse para generar un rendimiento deficiente. Debido a que JavaScript es de un solo subproceso y la coincidencia de expresiones regulares se ejecuta en el subproceso principal, un rendimiento deficiente bloqueará el bucle de eventos y provocará un ataque de denegación de servicio (DoS). La expresión regular incorrecta se genera cada vez que hay dos parámetros dentro de un solo segmento, separados por algo que no sea un punto (.). Para los usuarios de la versión 0.1, actualice a la versión 0.1.10. Todos los demás usuarios deben actualizar a la versión 8.0.0.","source":"nvd"}],"published":"2024-09-09T19:07:40.313Z","modified":"2026-09-10T03:50:36.768Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"version":"< 0.1.10","status":"affected"},{"version":">= 0.2.0, < 8.0.0","status":"affected"}],"vendor":"pillarjs","product":"path-to-regexp","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","fixed":"0.1.0","status":"affected"},{"type":"custom","introduced":"0.2.0","fixed":"8.0.0","status":"affected"}],"vendor":"pillarjs","product":"path-to-regexp","cpe":"cpe:2.3:a:pillarjs:path-to-regexp:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.1.13"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.2.0","status":"affected","fixed":"1.9.0"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.1.10"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"8.0.0"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.0.0","status":"affected","fixed":"3.3.0"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"6.3.0"}],"ecosystem":"npm","package":"path-to-regexp","purl":"pkg:npm/path-to-regexp","source":"ghsa"}],"references":[{"url":"https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-9wv6-86v2-598j","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/pillarjs/path-to-regexp/commit/29b96b4a1de52824e1ca0f49a701183cc4ed476f","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/pillarjs/path-to-regexp/commit/60f2121e9b66b7b622cc01080df0aabda9eedee6","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://security.netapp.com/advisory/ntap-20250124-0001/","tags":[],"sources":["cvelist","nvd"]},{"url":"https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-37ch-88jc-xwx2","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-4867","tags":["advisory"],"sources":["ghsa"]},{"url":"https://blakeembrey.com/posts/2024-09-web-redos","tags":["web"],"sources":["ghsa"]},{"url":"https://cna.openjsf.org/security-advisories.html","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/advisories/GHSA-9wv6-86v2-598j","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp/releases/tag/v.0.1.13","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45296","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp/commit/925ac8e3c5780b02f58cbd4e52f95da8ad2ac485","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp/commit/d31670ae8f6e69cbfd56e835742195b7d10942ef","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp/commit/f1253b47b347dcb909e3e80b0eb2649109e59894","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pillarjs/path-to-regexp/releases/tag/v6.3.0","tags":["web"],"sources":["ghsa"]},{"url":"https://security.netapp.com/advisory/ntap-20250124-0001","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2024-09-09T19:32:57.513Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-45296","url":"https://www.cve.org/CVERecord?id=CVE-2024-45296","licence":"CVE Terms of Use","modified":"2025-01-24T20:03:07.723Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-37ch-88jc-xwx2","url":"https://github.com/advisories/GHSA-37ch-88jc-xwx2","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:36.768Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9wv6-86v2-598j","url":"https://github.com/advisories/GHSA-9wv6-86v2-598j","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:18.832Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-45296","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45296","licence":"Public domain","modified":"2026-06-17T07:53:58.263Z"}],"updatedAt":"2026-11-25T22:58:45.187Z","epss":{"score":0.00932,"percentile":0.61768,"date":"2026-12-02T12:00:21.000Z"}}