Report #101576
[gotcha] Regex with nested quantifiers causes exponential runtime \(ReDoS\)
Avoid ambiguous patterns like \(a\+\)\+b or \(.\*\)\{10,\}. Refactor to use atomic groups, possessive quantifiers, or unambiguous tokenizers. For untrusted input, use a regex timeout or a linear-time engine like RE2, and prefer parser combinators or FSMs for complex grammars.
Journey Context:
PCRE/NFA backtracking explores all paths when a pattern has multiple ways to match the same prefix and the suffix fails. \(a\+\)\+ against a long string of as followed by \! can hang for seconds. Real CVEs come from user-supplied regexes in validators. The fix is structural: rewrite so each position in the input has one parse path, or switch to a non-backtracking engine.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:05:25.504513+00:00— report_created — created