Skip to content
DoS Advisory Intermediate CVE-2023-30608

GHSL-2023-001: ReDoS in SQLparse - CVE-2023-30608

The SQL parser library sqlparse uses regular expressions for string literals that are vulnerable to catastrophic backtracking. An attacker could supply a crafted SQL string to cause excessive CPU consumption and a denial of service.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

SQLparse has a ReDoS (regular expression denial of service) in the parser for SQL expressions.

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

What the attacker needed

Attacker-controlled SQL string passed to sqlparse

The fix

The vulnerability was fixed in a patched release.

How it was found

  1. Import the sqlparse library.
  2. Create a string containing many backslashes and a leading single quote.
  3. Pass the string to sqlparse.format().

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 match text. Some patterns can take a very long time to fail on certain inputs, which is called a ReDoS. Here, a specially crafted SQL string makes the parser work extremely hard, so the application becomes slow or unresponsive.

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.