Read the docs
TI-2026-42708 Aliases CVE-2026-59894GHSA-3496-9g83-7v6x

sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes

Priority LOW 27CWE-94Published · Updated

Key facts

Attack vector
Local
Privileges required
None
User interaction
Passive
Attack complexity
Low
Attack requirements
None
Impact type
Code execution
Confidentiality · integrity · availability
None · None · None
Fix status
Partial Red Hat: 12 without a fix

Attack profile from CVSS 4.0 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-94.

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00129 2nd percentileScored 2026-11-07
Fix Partial sqlparse (andialbrecht): 0.6.0sqlparse (PyPI): 0.6.0Red Hat: 12 without a fix

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
andialbrechtsqlparsebefore 0.6.00.6.0Patch availableCNA
—sqlparse (PyPI)before 0.6.00.6.0Patch availableGHSA-3496-9g83-7v6x
  • sqlparse Vendorandialbrecht Affected before 0.6.0 Fixed in 0.6.0 Patch available CNA
  • sqlparse (PyPI) Vendor— Affected before 0.6.0 Fixed in 0.6.0 Patch available GHSA-3496-9g83-7v6x

Remediation

  • Fix · CNA sqlparse (andialbrecht) Fixed in 0.6.0
  • Fix · GHSA-3496-9g83-7v6x sqlparse (PyPI) Fixed in 0.6.0 Advisory →

Vendor assessments

Red Hat

Red Hat rating: Moderate. Red Hat's page for this CVE →

ProductStatusPlan or fix
Red Hat Ansible Automation Platform 2AffectedNo fix yet: Fix deferred
Red Hat Discovery 2AffectedNo fix yet: Fix deferred
Red Hat OpenShift AI (RHOAI)AffectedNo fix yet: Fix deferred
Red Hat OpenShift Container Platform 4AffectedNo fix yet: Fix deferred
Red Hat OpenShift Container Platform 5AffectedNo fix yet: Fix deferred
Red Hat OpenStack Platform 16.2AffectedNo fix planned: Out of support scope
Red Hat OpenStack Platform 17.1AffectedNo fix planned: Out of support scope
Red Hat OpenStack Platform 18.0AffectedNo fix yet: Fix deferred
Red Hat Satellite 6AffectedNo fix yet: Fix deferred
Red Hat Update Infrastructure 4 for Cloud ProvidersAffectedNo fix planned: Out of support scope
Red Hat Update Infrastructure 5AffectedNo fix yet: Fix deferred
Self-service automation portal 2AffectedNo fix yet: Fix deferred

Timeline

  1. 2026-10-02 Threatist record created from CVE-2026-59894
  2. 2026-10-03 Alias added: GHSA-3496-9g83-7v6x
  3. 2026-11-06 Affected versions changed · Red Hat

References

  • TI-2026-39184 sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger CVSS 4.0HIGH 8.7
  • TI-2026-42707 sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service) CVSS 3.1HIGH 7.5
  • TI-2026-57940 sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption CVSS 4.0MEDIUM 5.1
  • TI-2026-50099 sqlparse: Quadratic O(n²) DoS in group_comments CVSS 4.0HIGH 8.7
  • TI-2026-76501 PHP code injection in sqlparse via output_format='php' CVSS 4.0HIGH 8.4

Sources