CVE-2026-59894

sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes

Published Aug 17, 2026 CVSS 4.0 · 6.2 Medium EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-3496-9g83-7v6x sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes
History
Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 5.3, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L'}

threat_severity

Moderate

Type Values Removed Values Added
First Time appeared Andialbrecht
Andialbrecht sqlparse
Vendors & Products Andialbrecht
Andialbrecht sqlparse
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes
Weaknesses CWE-94
References
Metrics cvssV4_0

{'score': 6.2, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:L'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 17, 2026, 10:01 PM
Reserved
Jul 7, 2026, 4:40 PM
Status
Deferred
Published
Aug 17, 2026, 6:17 PM
Modified
Oct 23, 2026, 4:10 PM
Severity
Moderate
Public date
Aug 17, 2026, 5:14 PM