CVE-2026-59894 sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes

Medium 6.2 Published Updated

Attackers can inject Python or PHP code via crafted SQL when using specific output formats in the sqlparse library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-59894?

CVE-2026-59894 is a medium-severity code injection vulnerability in andialbrecht sqlparse, published on 17 Aug 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse/filters/output.py fails to escape existing backslashes before quotes in sqlparse.format output_format='python' and output_format='php' and the corresponding sqlformat -l modes, allowing crafted SQL to terminate the generated string and inject Python or PHP code when a downstream consumer executes or imports the generated source. This issue is fixed in version 0.6.0.

Weakness: CWE-94

Which versions are affected by CVE-2026-59894?

3 open source packages ship an affected version, including sqlparse.

PackageAffectedFixed in
sqlparse PyPIAll versions0.6.0
sqlparse PyPIAll versions0.6.0
sqlparse PyPIAll versions0.6.0

How do I fix CVE-2026-59894?

Upgrade sqlparse to 0.6.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-59894 being exploited?

There is no known exploitation of CVE-2026-59894 in the wild and no public exploit code.

Sources

Also known as CLEANSTART-2026-EP84615, CLEANSTART-2026-VX89697, CLEANSTART-2026-ZF06742, DEBIAN-CVE-2026-59894, ECHO-29a6-7992-df6d, GHSA-3496-9g83-7v6x and 7 more.

Is CVE-2026-59894 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free