sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Partial Red Hat: 3 without a fix
Attack profile from CVSS 4.0 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-407.
Summary
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse.format(sql, reindent=True) and sqlformat --reindent route attacker-controlled parenthesized tuple lists through ReindentFilter._get_offset() in sqlparse/filters/reindent.py, where _flatten_up_to_token() repeatedly rebuilds and joins the statement prefix. Thousands of offset calculations walk an expanding token tree, producing quadratic CPU consumption for inputs that remain below MAX_GROUPING_TOKENS and causing request delays, reduced throughput, or worker starvation. This issue is fixed in version 0.6.0.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- 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
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| andialbrecht | sqlparse | before 0.6.0 | 0.6.0 | Patch available | CNA |
| — | sqlparse (PyPI) | before 0.6.0 | 0.6.0 | Patch available | GHSA-cfqr-cjx5-5jcm |
- 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-cfqr-cjx5-5jcm
Remediation
- Fix · CNA sqlparse (andialbrecht) Fixed in 0.6.0
- Fix · GHSA-cfqr-cjx5-5jcm sqlparse (PyPI) Fixed in 0.6.0 Advisory →
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat OpenStack Platform 16.2 | Affected | — |
| Red Hat OpenStack Platform 17.1 | Affected | — |
| Red Hat OpenStack Platform 18.0 | Affected | — |
Not affected: 2 products
- Red Hat OpenStack Platform 13 (Queens)
- Red Hat OpenStack Platform 16.2
Timeline
- 2026-10-02 Threatist record created from CVE-2026-84305
- 2026-10-03 Alias added: GHSA-cfqr-cjx5-5jcm
- 2026-10-05 Affected versions changed · Red Hat
- 2026-10-05 CVSS score added · Red Hat
References
More andialbrecht vulnerabilities
- 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-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
- TI-2026-42708 sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes CVSS 4.0MEDIUM 6.2
Sources
- CVE-2026-84305 · CVE Program
- CVE-2026-84305 · NVD
- FIRST EPSS
- GHSA-cfqr-cjx5-5jcm · GitHub Advisory Database · CC BY 4.0
- CVE-2026-84305 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences