{"id":"CVE-2026-59894","published":"2026-08-17T17:14:22Z","modified":"2026-08-17T22:01:42Z","title":"sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes","vendor":"andialbrecht","product":"sqlparse","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.2,"severity":"MEDIUM","version":"4.0","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","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00184,"percentile":0.04633,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x","tags":["x_refsource_CONFIRM"]}],"priority":{"score":5.3,"factors":[{"name":"EPSS percentile","points":0.93},{"name":"CVSS severity","points":4.34}]},"vendorSlug":"andialbrecht","affectedVersions":[{"vendor":"andialbrecht","product":"sqlparse","versions":["< 0.6.0"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2026-08-17T21:29:10.782733Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"sqlparse","vulnerableRanges":["<0.6.0"],"patched":["0.6.0"],"from":["GHSA-3496-9g83-7v6x","PYSEC-2026-3696"],"provenance":"source"}],"summary":{"text":"The sqlparse Python library, in its Python and PHP output formatting (sqlparse.format with output_format='python' or 'php', and the corresponding sqlformat -l modes), fails to escape existing backslashes before quotes in the generated string literals. An attacker who can supply crafted SQL to that formatter, with a local attack vector, no privileges, and user interaction required, can break out of the generated string and inject Python or PHP code, which executes when a downstream consumer runs or imports the generated source.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:20:13Z"},"euvd":{"id":"EUVD-2026-60308","exploited":false,"provenance":"source"}}