At a glance
- Controls
- CWE-1333
What it is
Some regular expressions can try an enormous number of ways to match a string before they give up. A short, carefully shaped input can make one such check run for seconds or minutes. While it runs, the server thread doing the work is stuck.
An attacker looks for any field that is checked by a vulnerable pattern, such as an email, a URL or a search box. They send a few crafted strings and watch response times climb until the service stops answering. AI tools can read a pattern and write the input that triggers the worst case within moments.
Where it hides
What a reviewer can look for in the code and in the behaviour, before anyone proves it.
- Email, URL and phone number validation on sign-up and profile forms
- Search and filter boxes that build patterns from user text
- Log parsing or content filtering jobs that run on user-supplied text
- Route matching and input checks in shared validation libraries
How MATT tests it
The proof runs against the deployed product, on every release, whoever wrote the code.
- 01Read the code to find regular expressions that run on user input and have nested or overlapping repetition
- 02Sign in with the test login and send a short crafted string to that field, growing it a few characters at a time
- 03Record how response time rises with input length, and stop once the growth is clear
No user input may reach a pattern that can backtrack without limit.
Executable checkas any user: POST /v1/profile with email = crafted string of 50 characters expect: response within 1 second expect: 400 for invalid input expect: response time does not grow sharply as the string gets longer
Every rule MATT holds →What the fix looks like
- 01
Rewrite risky patterns to remove nested and overlapping repetition
- 02
Use a regular expression engine with linear‑time matching where the language offers one
- 03
Cap input length before any pattern runs
- 04
Set a time limit on pattern matching where the runtime supports it
A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →