Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A ReDoS warning is a lead, not proof that an application is vulnerable. To establish the risk, identify the regex engine the application actually uses, reproduce the slowdown with a controlled input, and keep the test bounded. A repair must then pass both performance checks and tests for the matching and capture behavior the application relies on.

What counts as evidence of a ReDoS bug?

Regular expression denial of service (ReDoS) occurs when processing a particular input makes a regular expression take an unusually long time. As Kevin Backhouse of GitHub Security Lab puts it, “A ReDoS is a denial-of-service (DOS) vulnerability in which a regex runs exceptionally slowly on some inputs.” OWASP’s explanation of ReDoS describes how some backtracking engines can explore many possible paths through a pattern. The work can grow super-linearly or exponentially as input length increases.

Patterns such as (a+)+$ and (a|aa)+ illustrate common sources of ambiguity: nested repetition or alternatives that overlap. A long string that almost matches but ultimately fails can force a backtracking engine to retry many ways of dividing or matching the characters. The pattern alone, however, does not establish an exploitable application bug.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • A static warning identifies a pattern that may have risky structure. It does not show that the target engine slows down on an input the application can receive.
  • A timed reproduction demonstrates slow execution for a particular pattern, input, engine, and runtime environment. It is stronger evidence, but does not by itself establish how exposed the application is.
  • An application-level finding connects the slow match to the application’s actual use of the regex—for example, whether an attacker can supply the triggering input and whether the request path has relevant time or resource limits.

Backtracking behavior varies with the engine, its version, supported syntax, and how the expression is used. GitHub Security Lab discusses ReDoS issues in languages including Python and JavaScript, and describes CodeQL queries for JavaScript, Python, Java, C#, and Ruby. Its article also names Go, Rust, and RE2 as not vulnerable in the context it discusses; that is not a blanket guarantee for every regex API or system configuration. Check the engine that runs the specific application rather than inferring risk from the programming language alone. GitHub Security Lab’s ReDoS guidance explains these engine distinctions and its repair approach.

How to build a safe, reproducible proof

A useful proof answers three questions: which exact pattern is involved, which engine evaluates it, and what bounded input causes abnormal growth? The test should be isolated from production traffic and should stop if execution exceeds a defined limit. Do not run an unbounded adversarial input against a live service.

  1. Identify the target. Record the regex pattern, the application code path that invokes it, and the runtime’s regex engine and version. Include relevant flags and options.
  2. Create a controlled case. Start with the input shape that could reach the expression. For patterns like the OWASP examples, a long near-match that fails at the end can be useful, but the right input depends on the actual pattern and application.
  3. Bound execution. Run the test in an isolated process or worker with a timeout and resource limits. A timeout is a safety boundary, not a substitute for recording the runtime and conditions of the measurement.
  4. Measure increasing input sizes. Record elapsed time as input length grows. A sharp, repeatable increase is more informative than one slow run; account for ordinary runtime noise and avoid treating a single timing as conclusive.
  5. Minimize the reproducer. Reduce the pattern or input while retaining the slowdown. A small case is easier to review, regression-test, and connect to the application’s behavior.

GitHub Security Lab recommends reproducing a suspected issue before attempting a repair; its examples discuss reduction and fuzzing. The goal is not merely to make a scanner report a risky expression, but to retain a repeatable case that demonstrates the problem under the target engine.

What redosray says its offline workflow does

The redosray project documentation describes a two-stage workflow: flag static candidates, then execute each candidate in an isolated worker against a purpose-built input that grows geometrically. It says a finding includes the input that crosses its timeout and a growth curve. The project lists local CLI scanning for JavaScript, TypeScript, and Python, and says source code is not uploaded. These are claims made by the project documentation, not independently verified performance, privacy, or coverage results. Read the redosray project documentation for its current workflow and supported languages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Offline” can be useful when source must stay on a developer’s machine, but it does not itself prove that a finding is correct or that the tool covers every relevant syntax and runtime behavior. Before relying on a scanner, check whether its parser and execution stage match the project’s language, regex syntax, engine, and version. Confirm its timeout and isolation behavior, and inspect the reported reproducer rather than treating a green or red status as a complete security assessment.

How to decide whether a suggested fix is safe

Making a regex faster is not enough if it changes what the application accepts, rejects, or captures. A fix review should compare both performance and behavior in the application’s actual engine.

  1. Understand the intended behavior. Gather representative valid inputs, invalid inputs, boundary cases, and any capture groups or named groups consumed by calling code.
  2. Change the smallest justified part. Prefer a targeted rewrite over an unexplained replacement. Document the behavior the change is intended to preserve.
  3. Re-run the proof. Test the original reproducer against the changed pattern in the target engine, using the same bounded conditions. Confirm that the problematic growth is no longer observed within the test limits.
  4. Run differential and regression checks. Compare old and new match results for known cases and additional generated or fuzzed inputs where appropriate. Check capture contents and group positions if the application depends on them.
  5. Validate in context. Run the application’s own tests and check the code path that consumes the match result. A scanner’s test of an isolated expression cannot establish application-level equivalence.

Redosray says its fix flow offers a suggested rewrite only after dynamic non-hang confirmation and differential testing. That describes the project’s stated checks; it is not a guarantee that a rewrite preserves every application-specific semantic or capture dependency. Review the suggested change and test it against the application’s real contract.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to compare when choosing a ReDoS tool

Tools can answer different questions: a static analyzer may identify suspicious structure, while a dynamic scanner attempts to reproduce slow execution. For a meaningful evaluation, compare the following dimensions rather than relying on a single headline claim.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Language and syntax: Does it parse the project’s language and the regex constructs actually used?
  • Engine fidelity: Does dynamic testing use the relevant regex engine and version, or an approximation?
  • Evidence: Does it distinguish a static suspicion from a timed reproduction, and report the input and growth measurements?
  • Safety and privacy: Are runs isolated and bounded? Does source or pattern data leave the machine?
  • Repair validation: What does the tool test about non-hanging behavior, equivalence, captures, and application semantics?
  • Workflow fit: Are CI or pre-commit integration, supported platforms, licensing, and commercial-use terms suitable for the project?

Published research offers useful context, but not a direct benchmark for a particular scanner. The 2021 ReDoSHunter paper reports 100% precision and 100% recall on three large-scale datasets containing 37,651 regexes, and reports finding 28 new ReDoS vulnerabilities in 26 projects, with 26 assigned CVEs and two fixes. Those figures belong to the authors’ evaluation and datasets; they should not be attributed to redosray or generalized to other scanners. The paper also frames accurate detection at high precision and recall as a challenge for existing approaches. See the ReDoSHunter paper page from USENIX Security ’21.

Other documented approaches include CodeQL’s ReDoS queries and ReDoctor, whose repository describes a Python scanner combining static analysis and fuzzing. ReDoctor’s repository states that commercial production use requires a paid license under its BSL-1.1 terms and gives a planned MIT conversion date; verify the current repository terms before adopting it. CodeQL’s available queries and code-scanning integration are described in GitHub Security Lab’s article. Supported languages, licensing, and integrations can change, so use each project’s current documentation when making a deployment decision. ReDoctor’s repository and license information.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.