ReDoS: catastrophic backtracking in a regex input check
ReDoS, short for regular expression denial of service, happens when a validation regex takes exponential time on input that fails to match. On a local Python endpoint, every two extra letters multiplied the time spent in the regex by about four, and a 27-character request held the single-threaded server for 3.1 seconds. A rewritten linear pattern with a 64-character cap answered the same input in 6.6 ms.
This is a scripted Python and curl experiment with downloadable source and responses. No AI agent or model ran the test.
On this page: Scope · Reproduce the run · Observed results · Verify the finding · Fix and retest · Limits
What ReDoS is and what the fixture covers
CWE-1333 lists ReDoS and "catastrophic backtracking" as names for one weakness: a regular expression whose worst-case cost is inefficient and possibly exponential.…