CVE-2026-59894
NoneCVSS
—
EPSS
0.1%
Published
Aug 17, 2026
CISA due date
—
Cloudanix analysis
A tool that turns database queries into program code can be tricked into adding hidden instructions that run on your computer if you do not update it.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Other
- Component
- Library
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
Unescaped backslashes preceding quotes in sqlparse.format output for python and php modes allow crafted SQL to terminate generated strings and inject executable code into downstream Python or PHP consumers.
Why it matters to the business
Applications that format SQL and later execute or import the output risk arbitrary code execution; low EPSS and absence from KEV indicate limited observed exploitation 70 days after publication, reducing immediate operational urgency.
How an attack unfolds
An attacker supplies specially crafted SQL containing a backslash before a quote to sqlparse.format with output_format set to python or php; the resulting source code terminates the string literal early and appends attacker-controlled statements that execute when the generated file is imported or run.
How to fix it
Upgrade sqlparse to version 0.6.0 or later; avoid using the affected output_format modes until patched; review any code that executes or imports sqlparse-generated source.
How to confirm the fix worked
Confirm sqlparse version is at least 0.6.0; test format calls with known malicious SQL inputs to verify no code injection occurs; scan dependency manifests for older versions.
Typical attack path
- Identify application code paths that invoke sqlparse.format with python or php output modes
- Craft SQL input containing a backslash immediately before a quote character
- Pass the input through sqlparse.format to produce injectable source
- Cause the downstream consumer to execute or import the generated code
How to detect it
Search application logs for sqlparse.format calls with python or php output modes; inspect generated source files for unexpected string terminations or injected statements; review dependency trees for pre-0.6.0 versions.
What your security team should do
- Upgrade all instances of sqlparse to 0.6.0 or newer within 30 days
- Audit codebases for use of sqlparse.format with python or php output modes
- Disable or replace affected formatting modes where feasible
- Monitor EPSS trend for any increase indicating rising exploit availability
The record
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.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|
Related vulnerabilities
- CVE-2026-115878 Stanza is a Stanford NLP Python library for tokenization, sentence segmentation, NER, and… CWE-94
- CVE-2026-115731 Deserialization of untrusted data in the report-processing code of Puppet, as used by… CWE-94
- CVE-2026-63471 fastapi-code-generator creates FastAPI applications from OpenAPI files. CWE-94
- CVE-2026-63470 fastapi-code-generator creates FastAPI applications from OpenAPI files. CWE-94
- CVE-2026-63469 fastapi-code-generator creates FastAPI applications from OpenAPI files. CWE-94
- CVE-2026-44267 Elo is a purely functional expression language for no-code tools. CWE-94
- CVE-2026-44266 Elo is a purely functional expression language for no-code tools. CWE-94
- CVE-2026-44265 Elo is a purely functional expression language for no-code tools. CWE-94