{"id":"UBUNTU-CVE-2026-59894","details":"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.","modified":"2026-09-23T18:46:21.753416867Z","published":"2026-08-17T18:17:00Z","upstream":["CVE-2026-59894"],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2026-59894"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2026-59894"},{"type":"REPORT","url":"https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x"}],"affected":[{"package":{"name":"sqlparse","ecosystem":"Ubuntu:Pro:16.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra-legacy%2Fxenial"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.1.13-2ubuntu2","0.1.18-1","0.1.18-1ubuntu0.1~esm1"],"ecosystem_specific":{"binaries":[{"binary_name":"pypy-sqlparse","binary_version":"0.1.18-1ubuntu0.1~esm1"},{"binary_version":"0.1.18-1ubuntu0.1~esm1","binary_name":"python-sqlparse"},{"binary_name":"python3-sqlparse","binary_version":"0.1.18-1ubuntu0.1~esm1"},{"binary_name":"sqlformat","binary_version":"0.1.18-1ubuntu0.1~esm1"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}},{"package":{"name":"sqlparse","ecosystem":"Ubuntu:Pro:18.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra%2Fbionic"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.2.2-1","0.2.4-0.1","0.2.4-0.1ubuntu0.1","0.2.4-0.1ubuntu0.1+esm1"],"ecosystem_specific":{"binaries":[{"binary_name":"pypy-sqlparse","binary_version":"0.2.4-0.1ubuntu0.1+esm1"},{"binary_name":"python-sqlparse","binary_version":"0.2.4-0.1ubuntu0.1+esm1"},{"binary_name":"python3-sqlparse","binary_version":"0.2.4-0.1ubuntu0.1+esm1"},{"binary_version":"0.2.4-0.1ubuntu0.1+esm1","binary_name":"sqlformat"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}},{"package":{"name":"sqlparse","ecosystem":"Ubuntu:Pro:20.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra%2Ffocal"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.2.4-1","0.2.4-1build1","0.2.4-2","0.2.4-3","0.2.4-3ubuntu0.1","0.2.4-3ubuntu0.1+esm1"],"ecosystem_specific":{"binaries":[{"binary_name":"pypy-sqlparse","binary_version":"0.2.4-3ubuntu0.1+esm1"},{"binary_name":"python3-sqlparse","binary_version":"0.2.4-3ubuntu0.1+esm1"},{"binary_version":"0.2.4-3ubuntu0.1+esm1","binary_name":"sqlformat"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}},{"package":{"name":"sqlparse","ecosystem":"Ubuntu:22.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=jammy"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.4.1-1ubuntu1","0.4.2-1","0.4.2-1ubuntu0.22.04.1","0.4.2-1ubuntu0.22.04.2","0.4.2-1ubuntu0.22.04.3"],"ecosystem_specific":{"binaries":[{"binary_version":"0.4.2-1ubuntu0.22.04.3","binary_name":"python3-sqlparse"},{"binary_name":"sqlformat","binary_version":"0.4.2-1ubuntu0.22.04.3"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}},{"package":{"name":"sqlparse","ecosystem":"Ubuntu:24.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=noble"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.4.2-1ubuntu1","0.4.4-1","0.4.4-1ubuntu0.1","0.4.4-1ubuntu0.2"],"ecosystem_specific":{"binaries":[{"binary_name":"python3-sqlparse","binary_version":"0.4.4-1ubuntu0.2"},{"binary_version":"0.4.4-1ubuntu0.2","binary_name":"sqlformat"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}},{"package":{"name":"sqlparse","ecosystem":"Ubuntu:26.04:LTS","purl":"pkg:deb/ubuntu/sqlparse?arch=source&distro=resolute"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.5.3-1","0.5.4-1","0.5.4-1ubuntu0.1"],"ecosystem_specific":{"binaries":[{"binary_name":"python3-sqlparse","binary_version":"0.5.4-1ubuntu0.1"},{"binary_name":"sqlformat","binary_version":"0.5.4-1ubuntu0.1"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-59894.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"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"},{"type":"Ubuntu","score":"medium"}]}