Skip to content

πŸ›‘ ReDoctor

The Python ReDoS Vulnerability Scanner

Protect your applications from Regular Expression Denial of Service attacks with static analysis and intelligent fuzzing.

PyPI version Python versions License Tests


⚠ What is ReDoS?

Regular Expression Denial of Service (ReDoS) is a type of algorithmic complexity attack that exploits the worst-case behavior of regex engines. A vulnerable regex can cause your application to hang for minutesβ€”or even hoursβ€”when processing malicious input.

This innocent-looking regex is VULNERABLE!

import re
pattern = r"^(a+)+$"

# This will hang your application:
re.match(pattern, "a" * 30 + "!")  # Takes exponential time!

ReDoctor detects these vulnerabilities before they reach production.


⚑ Quick Start

1 Install

pip install redoctor

2 Check

redoctor '^(a+)+$'
# VULNERABLE: ^(a+)+$ - O(2^n)

3 Integrate

from redoctor import check

result = check(r"^(a+)+$")
if result.is_vulnerable:
    print(f"Attack: {result.attack}")

✨ Features

πŸ”¬ Hybrid Analysis Engine

Combines static automata-based analysis with intelligent fuzzing for comprehensive detection. Catches vulnerabilities that single-approach tools miss.

⚑ Fast & Zero Dependencies

Pure Python with no external dependencies. Runs in milliseconds for most patterns. Compatible with Python 3.6+.

🎯 Accurate Results

Generates proof-of-concept attack strings with complexity analysis (O(n²), O(2ⁿ), etc.). Low false-positive rate through recall validation.

πŸ›‘ Source Code Scanning

Scan your entire Python codebase for vulnerable regex patterns. Integrates seamlessly with CI/CD pipelines.


πŸ“Š Complexity Analysis

ReDoctor classifies vulnerabilities by their time complexity:

Complexity Description Risk Level
O(n) Linear β€” Safe βœ… Safe
O(n²) Quadratic ⚠ Moderate
O(n³) Cubic ⚠ High
O(2ⁿ) Exponential ❌ Critical

πŸ€– How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ReDoctor Engine                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚   Automaton     β”‚         β”‚     Fuzz        β”‚           β”‚
β”‚  β”‚   Checker       β”‚         β”‚    Checker      β”‚           β”‚
β”‚  β”‚                 β”‚         β”‚                 β”‚           β”‚
β”‚  β”‚  β€’ NFA analysis β”‚         β”‚  β€’ VM execution β”‚           β”‚
β”‚  β”‚  β€’ Witness gen  β”‚         β”‚  β€’ Step countingβ”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚           β”‚                           β”‚                     β”‚
β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚                       β”‚                                     β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”                            β”‚
β”‚              β”‚ Recall Validatorβ”‚                            β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚
β”‚                       β”‚                                     β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”                            β”‚
β”‚              β”‚   Diagnostics   β”‚                            β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Learn more about how ReDoctor works β†’


πŸš€ Get Started


500+ Tests Passing

0 Dependencies

3.6+ Python Version

<10ms Typical Analysis