# CVE-2026-59894: sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes

- Priority: **Routine**
- Reason: Not severe (CVSS 6.2, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2026-08-17 · Modified: 2026-08-17
- Aliases: GHSA-3496-9g83-7v6x, PYSEC-2026-3696, UBUNTU-CVE-2026-59894, DEBIAN-CVE-2026-59894, CGA-7vx5-pm62-6pqg, CGA-7xrj-6mgj-w6xh, CGA-8j8h-6rgv-x95q, CGA-9jm4-m7gg-g7mq, CGA-gxwh-m6qm-57q9, CGA-h2q5-27xv-xm6x, CGA-hjvg-65cr-rjp4, CGA-j7mw-5r33-xv94, CGA-qpgr-gpq3-2rjq, CGA-2325-2rvw-ggw6, CGA-2fw3-jf32-57hm, CGA-2x2c-8w4w-w669, CGA-3399-h9mm-3jp3, CGA-3fgc-2qfj-pp4p, CGA-3qxc-2g4j-99fv, CGA-3rwx-9qj7-rwv5, CGA-4c98-747p-7rpr, CGA-4cfr-3pcx-3jc9, CGA-4g2m-24w6-7j7x, CGA-4hmr-hv7r-3c77, CGA-4rx5-w2wr-4j98, CGA-5g7h-8whc-g7q2, CGA-5mgm-56g8-pq9w, CGA-5rmc-qv94-hj33, CGA-5rpx-c2q3-g4w8, CGA-624j-qww6-jm29, CGA-64pc-w7p8-pvw4, CGA-652q-q8qf-c7x5, CGA-663q-rvhg-9vcx, CGA-6p3r-2h97-7w5m, CGA-6qx3-m893-m54r, CGA-72f6-2q5f-8269, CGA-7c48-9p62-72xg, CGA-7h92-pr45-f9rx, CGA-7j68-mqv4-mhjr, CGA-7jx4-jp93-9pxm, CGA-7m6g-h678-j79x, CGA-8qfx-94jj-wmx5, CGA-98pj-2j4q-9h4v, CGA-99f8-fpxh-9w2w, CGA-9g3q-q9hq-926h, CGA-9hj6-6cp3-6cq5, CGA-c47g-6jj6-wq2r, CGA-c62j-q4v9-prj4, CGA-c9r7-7phw-q63h, CGA-cch8-cr8m-7hmh, CGA-ccqq-44fq-m4x3, CGA-cm6f-7c64-695x, CGA-cv96-g6vv-m377, CGA-f3x9-m6x6-5r68, CGA-f5hx-w88w-qqmx, CGA-f652-gmr3-wj48, CGA-fp9q-qrv4-gfq5, CGA-fqwp-rvjx-cqq3, CGA-fwcg-wf38-mpqr, CGA-g2mq-q88c-7gqg, CGA-g7cx-8mjm-w4xw, CGA-g8c7-g347-qvj6, CGA-g8x4-jvgh-579c, CGA-g926-pm32-mcfw, CGA-gf5q-3f6w-76pr, CGA-gfw6-rwc5-g793, CGA-gqj6-w346-42xm, CGA-gr63-jq7r-jm8g, CGA-gw65-433g-47g5, CGA-h34j-p9x3-f4wh, CGA-h34p-xvw5-2q5p, CGA-h8fh-3qxc-hmmp, CGA-h946-96xr-x9c6, CGA-hh8g-63rq-76f7, CGA-hh97-pr9p-8889, CGA-hp8h-wxf4-463x, CGA-j5p7-qx3v-x6jq, CGA-j6fj-wgfq-v775, CGA-j8p5-5cjf-7w7w, CGA-j8x5-4347-m563, CGA-jmj9-rx7w-ppx8, CGA-jr5f-hp5j-8966, CGA-mcgj-5v9p-pfhm, CGA-mg79-vqcm-3px8, CGA-mhgx-c49r-fv7f, CGA-mmc8-m4ch-5g3c, CGA-mmcp-32hm-wg22, CGA-mpxx-jffr-ppm3, CGA-p224-ghmj-2vg3, CGA-p6xm-97pf-ghf5, CGA-p8mm-xxwm-v22x, CGA-p984-225r-h5w2, CGA-phgc-m8rc-gx52, CGA-pqjj-v499-2ppj, CGA-pr87-8jv6-2pq8, CGA-prh5-27hw-5q4h, CGA-pvqv-4783-q68h, CGA-pw5j-vf84-jqrq, CGA-q43m-rqg3-539c, CGA-q442-rg4v-p42r, CGA-q95j-g27g-cx4g, CGA-qchp-g8g4-jhw6, CGA-qf3c-g357-fpr5, CGA-qm4x-g8x3-r6mw, CGA-r34j-v82m-cvh4, CGA-r36m-j8m3-24wh, CGA-r3mq-jx9p-9j86, CGA-r875-r5p2-r842, CGA-rrqg-5gph-4cmh, CGA-rx3r-c9vq-89f3, CGA-v7gf-5gv8-2jj2, CGA-v85p-cf38-973f, CGA-vc64-8v6g-7rqf, CGA-vhqf-7m3p-6v7q, CGA-vrqf-98p2-x2q2, CGA-w473-7756-cffc, CGA-w4f9-qjfm-wpq8, CGA-wcp8-wfjj-v6jr, CGA-x5f2-8jf2-q96w, CGA-x935-r7v3-cxrm, CGA-xfhm-5hh4-7gvg, CGA-xmh2-2gmx-976j, CGA-xp4w-7r78-vfcp, CGA-xxxr-4w7q-6jrw
- Record: https://cvemate.com/vulnerability/CVE-2026-59894 · JSON: https://cvemate.com/vulnerability/CVE-2026-59894/json

## 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.
```

## Signals

- CVSS: 6.2 medium (v4.0, CVE.org) 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
- EPSS: 0.129%, percentile 2.695%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 68)

- andialbrecht sqlparse: \< 0.6.0
- chainguard airflow-2 (Chainguard): \< 2.11.2-r16
- chainguard airflow-3 (Chainguard): \< 3.3.1-r3
- chainguard airflow-3-iamguarded-compat (Chainguard): All versions (No fix recorded)
- chainguard airflow-core-2 (Chainguard): \< 2.11.2-r7
- chainguard apache-beam-python-3.14-sdk (Chainguard): \< 2.75.0-r2
- chainguard authentik-2025.12 (Chainguard): \< 2025.12.6-r8
- chainguard authentik-2026.2 (Chainguard): \< 2026.2.6-r16
- chainguard authentik-2026.5 (Chainguard): \< 2026.5.6-r9
- chainguard authentik-fips-2025.12 (Chainguard): \< 2025.12.6-r9
- chainguard authentik-fips-2026.2 (Chainguard): \< 2026.2.6-r16
- chainguard authentik-fips-2026.5 (Chainguard): \< 2026.5.6-r10
- chainguard datahub-ingestion (Chainguard): \< 1.7.0-r2
- chainguard datahub-ingestion-fips (Chainguard): \< 1.7.0-r2
- chainguard dbt-bigquery (Chainguard): \< 1.10.3-r8
- chainguard dbt-core (Chainguard): \< 1.12.3-r0
- chainguard label-studio (Chainguard): \< 1.23.0-r12
- chainguard mlflow (Chainguard): \< 3.16.0-r0 \| \< 3.15.1-r4
- chainguard mlflow-fips (Chainguard): \< 3.15.1-r3
- chainguard mycli (Chainguard): \< 2.16.0-r1

## References

- <https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x>
- <https://github.com/andialbrecht/sqlparse/commit/53ff44b53e27cff78259acc1af015506fea60f63>
- <https://github.com/andialbrecht/sqlparse>
- <https://pypi.org/project/sqlparse>
- <https://github.com/advisories/GHSA-3496-9g83-7v6x>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-59894>
- <https://ubuntu.com/security/CVE-2026-59894>
- <https://www.cve.org/CVERecord?id=CVE-2026-59894>
- <https://security-tracker.debian.org/tracker/CVE-2026-59894>
- <https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59894.json>

---

Data as of 2026-12-05T09:54:41.769Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
