CVE-2026-59894 PUBLISHED

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

Assigner: GitHub_M
Reserved: 07.07.2026 Published: 17.08.2026 Updated: 17.08.2026

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.

Metrics

CVSS 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
CVSS Score: 6.2

Product Status

Vendor andialbrecht
Product sqlparse
Versions
  • Version < 0.6.0 is affected

References

Problem Types

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