Skip to content
DoS Write-up Intermediate

What’s the risk

The blog post explains regular expression injection, where user input is used unsanitised to build a regex, leading to regular expression denial of service (ReDoS). It gives three real examples where an attacker could cause a process to hang by supplying a crafted filename or job ID.

dee-see Follow

Published on blog.deesee.xyz

Regular expression injection is a common bug that doesn’t get talked about a lot. This blog post covers how to find that bug and has 3 examples of vulnerabilities found in real applications.

dee-see, on blog.deesee.xyz

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the application constructs a regular expression from unsanitised user input without escaping special characters, allowing an attacker to inject regex syntax that causes excessive backtracking.

Impact

An attacker could slow down or take down a service, and if the vulnerable code runs in a cloud function like AWS Lambda, it could create a very large bill.

What the attacker needed

Ability to create files or objects with controlled names; ability to trigger search or matching operation

The fix

The fix is to avoid building regexes from user input when possible, or to escape special characters using built-in functions like Regexp.escape in Ruby or Regex.Escape in C#.

How it was found

  1. Create a file with a name containing a crafted regex pattern and specific content.
  2. Search for that content, triggering the vulnerable code that builds a regex from the file extension.
  3. The regex engine hangs due to catastrophic backtracking, causing denial of service.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Regular expressions are patterns used to search or match text. If a program builds such a pattern directly from something a user types, an attacker can supply a pattern that takes a very long time to evaluate, making the program freeze. This is called a denial of service because it stops the service from working for others.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by dee-see

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.