CVE-2026-59894

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

State
Published
Severity
6.2 Medium
Published
Aug 17, 2026
Updated
Aug 17, 2026
Reserved
Jul 7, 2026

Read the record on cve.org

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.

Scores

CVSSScoreVectorSource
4.06.2 MediumCVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:H/SA:LGitHub_M

Weaknesses

  • CWE-94 Improper Control of Generation of Code ('Code Injection')

Affected Products

ProductVersions
sqlparseandialbrecht
  • < 0.6.0Affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.