Code Injection in sqlparse (CVE-2026-59894)
Summary
Code injection in sqlparse (CVE-2026-59894). Risk of unauthorized operations or information disclosure. Exploitable via EVOHUNT_OUTPUT_FORMAT_INJECTION_VERIFIED. Mitigation: upgrade to 0.6.0 or later.
Original description
The description as published by the source.
Summary
The documented Python and PHP output modes generate source-code snippets from caller-supplied SQL. Their output filters escape quote characters without first escaping existing backslashes. Crafted SQL can therefore neutralize the generated quote escape, terminate the intended language string, and place attacker-controlled code into the generated snippet. If a downstream consumer executes or imports that generated source, the injected code runs in the consumer's environment.
Details
The Python output filter places SQL in a single-quoted string and replaces each single quote with an escaped quote. The PHP output filter performs the equivalent operation for a double-quoted string. Neither transformation escapes pre-existing backslashes before escaping quotes. A backslash supplied immediately before a quote causes the generated backslash to be escaped instead of the quote, allowing the quote to close the string.
The affected modes are exposed through sqlparse.format(..., output_format='python'), sqlparse.format(..., output_format='php'), and the corresponding sqlformat -l options. Formatting produces the injected source but does not itself execute it; code execution occurs when a downstream workflow treats the generated snippet as Python or PHP code.
Relevant code locations:
sqlparse/formatter.py:193— selection of the output-language filterssqlparse/filters/output.py:45— opening of the generated Python string- `sqlparse/filters/output.py:65…
Source: GitHub Security Advisories (Global) NVD GitHub Advisory
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2026-59894 has been found in sqlparse.
Attackers can target a specific entry point like EVOHUNT_OUTPUT_FORMAT_INJECTION_VERIFIED over the network to misuse the product.
Risk of unauthorized operations or information disclosure.
What to do: upgrade sqlparse to 0.6.0 or later.
If unsure, ask your IT team or search "sqlparse CVE-2026-59894" on the vendor's site.
CVE-2026-59894 (sqlparse) — CWE-94
Attack surface: EVOHUNT_OUTPUT_FORMAT_INJECTION_VERIFIED
Patched: 0.6.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Arbitrary code execution (CWE-94) exists in sqlparse. Attackers reach the vulnerable code path via EVOHUNT_OUTPUT_FORMAT_INJECTION_VERIFIED.
Check the vendor advisory for the affected versions of sqlparse. Attack surface: EVOHUNT_OUTPUT_FORMAT_INJECTION_VERIFIED.
Severity: ?. Risk of unauthorized operations or information disclosure.
Update to 0.6.0.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'sqlparse' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'sqlparse' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
sqlparseを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade sqlparse to 0.6.0ステージング環境で 0.6.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
Fix status by distribution
Fixed packages published by each distribution for this CVE
- Debian DEBIAN-CVE-2026-59894 sqlparse
- Ubuntu UBUNTU-CVE-2026-59894 sqlparse
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- package pypi.org
- web github.com
- web github.com