Skip to content
DoS Advisory Intermediate

GHSL-2021-110: ReDoS in validators

The validators library's URL validation used an inefficient regular expression that could take an extremely long time on a crafted input string. An attacker could use such input to cause a denial of service in applications that call the validator.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

validators contains a regular expression that is vulnerable to ReDoS (Regular Expression Denial of Service).

ghsecuritylab, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the URL validation regular expression contained nested or ambiguous repetition that allowed catastrophic backtracking on crafted input.

Impact

This issue may lead to a denial of service.

What the attacker needed

Application calls validators.url on untrusted input

How it was found

  1. Install the validators library with pip.
  2. Run a short Python script that calls the URL validator on a crafted string.
  3. Observe that the call does not terminate.

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 report has not been written yet. The Original tab links to the source.

A regular expression is a pattern used to check text. Some patterns can be written so that certain long inputs make the computer try a huge number of combinations, effectively freezing it. Here, passing a specially crafted URL-like string to the library's URL checker could make the program hang instead of returning an answer.

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 ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

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.