CVE-2026-59894 json
sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes
published 2026-08-17 2 mo ago modified 2026-10-23 17 d ago also EUVD-2026-60308 , GHSA-3496-9g83-7v6x , PYSEC-2026-3696
- cvss
- 6.2
- version 4.0, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.1%
- EPSS 0.1% chance of exploitation in 30 days, percentile 2%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi sqlparse 0.6.0
- sqlparse_project sqlparse 0.6.0
- python-sqlparse SLE Module for Public Cloud 15 SP5, SLE Module for Public Cloud 15 SP4 0.4.4-150400.6.16.1
- python-sqlparse SLES for SAP 15 SP6, SLES 15 SP6-LTSS, SLE Module for Python 3 15 SP7 +1 more 0.4.4-150600.3.9.1
- python3-sqlparse SLES for SAP 15 SP6, SLES for SAP 15 SP5, SLES for SAP 15 SP4 +8 more 0.4.2-150300.23.1
- python-sqlparse SLES for SAP applications 16.0, SLES 16.0 0.5.3-160000.4.1
- python-sqlparse SLE Module for Package Hub 15 SP7 0.2.4-150100.6.11.1
suse advisories SUSE-SU-2026:3910-1SUSE-SU-2026:3907-1SUSE-SU-2026:3906-1SUSE-SU-2026:23561-1SUSE-SU-2026:3762-1
- python-sqlparse openSUSE Leap 16.0 0.5.3-160000.4.1
- python-sqlparse openSUSE Tumbleweed 0.6.0-1.1
opensuse advisories openSUSE-SU-2026:21690-1openSUSE-SU-2026:11557-1
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2026-59894 updated cvss 5.3
sqlparse: sqlparse: Arbitrary code execution via unescaped backslashes in generated snippets
-
Red Hat Ansible Automation Platform 2 python-sqlparse 0.5.3-3.el10ap, python3x-sqlparse 0.5.0-1.el8ap, python3.11-sqlparse 0.5.3-2.el9ap, python3.12-sqlparse 0.5.3-3.el9ap, ansible-automation-platform-24/hub-rhel8, ansible-automation-platform-25/hub-rhel8, +24 moreaffected: workaround, no fix available, no fix planned “Out of support scope”
-
Red Hat Discovery 2 discovery/discovery-server-rhel9 Red Hat OpenShift AI (RHOAI) rhoai/odh-mlflow-rhel9, rhoai/odh-th-torch-cpu-py312-rhel9, rhoai/odh-th-torch-cuda-py312-rhel9, rhoai/odh-th-torch-rocm-py312-rhel9, rhoai/odh-th06-cpu-torch210-py312-rhel9, rhoai/odh-th06-rocm64-torch291-py312-rhel9, +16 more Red Hat OpenShift Container Platform 4 python2-sqlparse, python3-sqlparse, openshift4/ose-ironic-rhel9 Red Hat OpenShift Container Platform 5 openshift5/ose-ironic-rhel9affected: workaround, no fix available “Fix deferred”
-
Red Hat OpenStack Platform 16.2 python3-sqlparse, rhosp-rhel8/openstack-ec2-api, rhosp-rhel8/openstack-tempest, rhosp-rhel8/openstack-aodh-api, rhosp-rhel8/openstack-heat-all, rhosp-rhel8/openstack-heat-api, +77 more Red Hat OpenStack Platform 17.1 python3-sqlparse, python-sqlparse 0.5.3-3.el10apaffected: workaround, no fix planned “Out of support scope”
-
Red Hat OpenStack Platform 18.0 rhoso/openstack-horizon-rhel9, python-sqlparse 0.5.3-3.el10ap, rhoso/openstack-aodh-api-rhel9, rhoso/openstack-heat-api-rhel9, rhoso/openstack-keystone-rhel9, rhoso/openstack-nova-api-rhel9, +61 more Red Hat Satellite 6 python3-sqlparse, python-sqlparse 0.5.3-3.el10ap, python3.12-sqlparse 0.5.3-3.el9ap, satellite/iop-advisor-backend-rhel9, tfm-pulpcore-python-sqlparse 0.4.2-2.el7pcaffected: workaround, no fix available “Fix deferred”
-
Red Hat Update Infrastructure 4 for Cloud Providers python-sqlparse 0.5.3-3.el10apaffected: workaround, no fix planned “Out of support scope”
-
Red Hat Update Infrastructure 5 rhui5/rhua-rhel9, rhui5/rhua-tp-rhel9 Red Hat Self-service automation portal 2 ansible-automation-platform/bootc-automation-portal-rhel9affected: workaround, no fix available “Fix deferred”
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 2 mo ago
Exploit prediction
0.13% chance of exploitation in the next 30 days, higher than 2% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 4.0 | 6.2 | 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 |
| CNA | 4.0 | 6.2 | 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | sqlparse | <0.6.0 |
0.6.0 |
Affected products
- andialbrecht sqlparse
Classification
- Weakness
-
- CWE-94 Improper Control of Generation of Code
References
-
github.com
/andialbrecht/sqlparse/commit/53ff44b53e27cff78259acc1af015506fea60f63
web
-
github.com
/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x
web
-
github.com
/andialbrecht/sqlparse
package
-
pypi.org
/project/sqlparse
package
-
github.com
/advisories/GHSA-3496-9g83-7v6x
advisory
-
nvd.nist.gov
/vuln/detail/CVE-2026-59894
advisory
Sources
- CVE List CVE-2026-59894
- GitHub Advisory GHSA-3496-9g83-7v6x
- NVD CVE-2026-59894
- OSV PYSEC-2026-3696
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.
CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.