SQL Injection Risk in sqlparse Package: CVE-2026-59894

sqlparse Updated 18 Aug 2026

Summary

17/08/2026
N/A
No i
Unrated
Not published

DEBIAN-CVE-2026-59894: sqlparse is a non-validating SQL parser module for Python. Affects sqlparse versions 0.4.1-1 – 0.5.5-2. No fix is published. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

sqlparse is a non-validating SQL parser module for Python, widely used for formatting SQL queries. It provides a simple interface for parsing and formatting SQL statements, making it a popular choice among developers. However, prior to version 0.6.0, sqlparse had a critical vulnerability that allowed crafted SQL to inject malicious Python or PHP code, posing significant security risks.

Vulnerability Detail

The vulnerability arises from sqlparse's failure to escape existing backslashes before quotes in the output formats 'python' and 'php'. This flaw allows an attacker to craft SQL that can terminate the generated string, leading to potential code injection when the output is executed or imported by a downstream consumer. The issue was identified in versions prior to 0.6.0 and has been addressed in the latest release.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If immediate upgrading is not feasible, a temporary workaround is to sanitize any SQL input and output manually, ensuring that backslashes are properly escaped before processing. However, this is not a foolproof solution and should only be considered as a stopgap measure.

Conclusion

The sqlparse package has a critical vulnerability (CVE-2026-59894) that can lead to SQL injection attacks. It is crucial to update to version 0.6.0 or later to mitigate this risk. Regular monitoring of dependencies using tools like Vulert can help maintain the security of your applications.

See every vulnerability recorded for sqlparse →

Share this vulnerability

FAQ

CVE-2026-59894 is a vulnerability in the sqlparse package that allows for SQL injection attacks due to improper escaping of backslashes.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which analyzes your manifest file for vulnerabilities.

Failing to address this vulnerability can lead to unauthorized code execution, data breaches, and potential compromise of your application.

Yes, tools like Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software without requiring access to the code.

If an immediate upgrade is not possible, implement input sanitization as a temporary workaround until you can update to a secure version.

Related vulnerabilities

Recent vulnerabilities recorded for sqlparse.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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