CVE-2026-59893: sqlparse Denial of Service via Inefficient Regex Handling of Dollar-Quoted SQL Literals

sqlparse Updated 18 Aug 2026

Summary

17/08/2026
Yes i
High
7.5

CVE-2026-59893: sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service). Affects sqlparse versions < 0.6.0. Fixed in 0.6.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

sqlparse is a popular Python library used for parsing SQL statements. It provides a simple interface for formatting and splitting SQL queries, making it a valuable tool for developers working with databases. However, sqlparse has a vulnerability that can lead to denial of service due to inefficient handling of regular expressions, particularly in dollar-quoted SQL literals.

Vulnerability Detail

The vulnerability in sqlparse arises from a Regular Expression Denial of Service (ReDoS) issue in its lexer for dollar-quoted SQL literals. The regex pattern used to match closing dollar-quote delimiters employs a backreference, which can cause O(n²) CPU complexity when processing inputs with many unique unmatched dollar-quote opening sequences. An attacker can exploit this vulnerability by supplying crafted SQL text, leading to sustained CPU exhaustion and denial of service. This issue does not require any authentication or special privileges, making it easily exploitable.

How To Fix

Latest published version: 0.6.0 as of 23 Oct 2026

pip install --upgrade "sqlparse==0.6.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid passing user-controlled SQL text directly to sqlparse functions such as parse(), format(), or split(). Implement input validation to restrict the types of SQL queries that can be processed.

Conclusion

The sqlparse library has a critical vulnerability (CVE-2026-59893) that can lead to denial of service through inefficient regex handling. It is essential to update to the patched version to protect your applications from potential exploitation. Utilize tools like Vulert for ongoing monitoring of vulnerabilities in your software.

See every vulnerability recorded for sqlparse →

Share this vulnerability

FAQ

CVE-2026-59893 is a vulnerability in the sqlparse library that can lead to denial of service due to inefficient regex handling of dollar-quoted SQL literals.

You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to use the Vulert playground without signup.

The CVSS score for this vulnerability is 7.5, indicating a high severity level.

Update sqlparse to version 0.6.0 or later using the command pip install --upgrade sqlparse to mitigate this vulnerability.

Yes, this vulnerability can be exploited without any authentication or special privileges, making it a significant risk for applications using sqlparse.

Related vulnerabilities

Recent vulnerabilities recorded for sqlparse.

How To Fix

Latest published version: 0.6.0 as of 23 Oct 2026

pip install --upgrade "sqlparse==0.6.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback