Key Facts
- Category
- Security & Validation
- Input Types
- textarea, text, number
- Output Type
- json
- Sample Coverage
- 4
- API Ready
- Yes
Overview
The ReDoS Scanner is a security utility that evaluates regular expressions for catastrophic backtracking vulnerabilities. By combining static heuristics with near-miss input simulations, it identifies risky patterns, benchmarks worst-case execution times, and provides safer rewrite suggestions to prevent Regular Expression Denial of Service attacks.
When to Use
- •Auditing user-submitted regular expressions before allowing them to execute on your server.
- •Reviewing complex nested quantifiers in legacy codebases during security audits.
- •Testing input validation patterns for potential performance bottlenecks under edge-case conditions.
How It Works
- •Paste one or more regular expressions into the input field, one per line, without surrounding slashes.
- •Optionally specify JavaScript regex flags, maximum evil input length, and the number of simulation runs.
- •The scanner analyzes the patterns using static heuristics and generates near-miss attack strings to benchmark execution time.
- •Review the generated JSON report detailing risk levels, worst-case execution times, and suggested safer rewrites.
Use Cases
Examples
1. Evaluating a login validation regex
Backend Developer- Background
- A developer is implementing a new email and username validation schema on a Node.js server.
- Problem
- Nested quantifiers in the validation regex might expose the server to ReDoS attacks if a malicious user submits a carefully crafted payload.
- How to Use
- Paste the regex ^(\w+\s?)*$ into the Regex List, set Max Evil Input Length to 64, and run the scan.
- Example Config
-
Flags: (empty), Max Evil Input Length: 64, Simulation Runs: 200 - Outcome
- The scanner flags the pattern as 'critical', reports the worst simulated execution time, and suggests a non-backtracking alternative.
2. Auditing legacy text parsing scripts
Security Engineer- Background
- A security team is reviewing an older application that uses complex regular expressions to parse large log files.
- Problem
- The team needs to identify which specific regex patterns are causing intermittent CPU spikes during log processing.
- How to Use
- Paste multiple regex patterns into the Regex List (one per line), configure the simulation runs to 500, and execute the benchmark.
- Example Config
-
Flags: g, Max Evil Input Length: 128, Simulation Runs: 500 - Outcome
- A JSON report is generated detailing the risk score for each pattern, isolating the exact regex causing the CPU spikes, and providing safer rewrites.
Try with Samples
regexFAQ
What is catastrophic backtracking?
It occurs when a regular expression engine evaluates a complex pattern against a near-miss string, causing execution time to grow exponentially and potentially crashing the application.
How does the scanner generate evil inputs?
It analyzes the regex structure to craft specific near-miss strings designed to trigger worst-case backtracking scenarios up to your specified maximum length.
Do I need to include slashes in my regex?
No, paste the raw pattern without the surrounding forward slashes (e.g., (a+)+$ instead of /(a+)+$/).
What do the simulation runs do?
The simulation runs dictate how many times the regex engine attempts to match the generated evil input, providing a reliable benchmark for execution time.
Can this tool fix my vulnerable regex automatically?
The tool provides a safer rewrite suggestion in its JSON output, but you should always test the suggested pattern to ensure it meets your specific validation requirements.