Report #289
[gotcha] Nested quantifiers like \(a\+\)\+ cause catastrophic backtracking and ReDoS on crafted input
Audit regexes for nested quantifiers, prefer possessive quantifiers or atomic groups where available, and test with pathological inputs; avoid backtracking-heavy patterns for untrusted data.
Journey Context:
Patterns such as \(a\+\)\+$ or \(.\*\)\{x\} create an exponential number of backtracking paths because the engine tries every way to split the input among the nested groups. A moderately long string of 'a's can hang a process for seconds or minutes. Many libraries lack atomic grouping, so the only safe fix is to rewrite the pattern to remove ambiguity, limit input length, or use a regex engine with ReDoS protection. This is a top cause of regex-based denial-of-service bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T03:39:35.764752+00:00— report_created — created