path-to-regexp vulnerable to Denial of Service via sequential optional groups
High severity
GitHub Reviewed
Published
Mar 26, 2026
in
pillarjs/path-to-regexp
•
Updated Mar 27, 2026
Description
Published by the National Vulnerability Database
Mar 26, 2026
Published to the GitHub Advisory Database
Mar 27, 2026
Reviewed
Mar 27, 2026
Last updated
Mar 27, 2026
Impact
A bad regular expression is generated any time you have multiple sequential optional groups (curly brace syntax), such as
{a}{b}{c}:z. The generated regex grows exponentially with the number of groups, causing denial of service.Patches
Fixed in version 8.4.0.
Workarounds
Limit the number of sequential optional groups in route patterns. Avoid passing user-controlled input as route patterns.
References