Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft comment-only SQL payload (~250 KB)
-
DeliverySubmit to network-exposed endpoint accepting SQL input
-
ExploitApplication invokes sqlparse.parse() or format(sql, strip_comments=True)
-
Executiongroup_comments enters O(n²) rescan loop
-
PersistCPU core saturated for minutes per request
-
ImpactApplication unavailability / denial of service
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V2 - Validation and Business Logic Resource consumption limits
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The target application must pass attacker-controlled SQL text to either sqlparse.parse() or sqlparse.format() with the strip_comments=True argument - no other configuration is required. The payload must consist of single-line SQL comments ('-- text\n' repeated), which is a valid SQL construct that any SQL-accepting endpoint might receive. No authentication is required (CVSS PR:N), no special server configuration is needed, and the MAX_GROUPING_TOKENS guard explicitly does NOT limit this code path because group_comments runs before it. The principal limiting factor is that the attacker must be able to reach an application endpoint that invokes sqlparse on their input - applications that do not expose SQL parsing to external input are unaffected. Purely internal tooling (CLI migration scripts, developer tools) faces lower risk than web-facing applications that sanitize or log SQL from user sessions. |
| Impact | The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N/VA:H) scores 8.7 and accurately reflects the threat: network-reachable, zero authentication, no attack complexity, with high availability impact. The algorithmic guarantee of O(n²) means resource exhaustion is deterministic and reproducible - this is not a probabilistic or race-condition vulnerability. The PoC provided in GHSA-f2ff-p2ww-7p4p demonstrates that a ~250 KB payload (4,000 single-line comments) saturates CPU for minutes on CPython 3.14, and the doubling ratio of ~4x confirms the quadratic curve. No EPSS score was provided in source data, and the vulnerability is not listed in CISA KEV, indicating no confirmed in-the-wild exploitation at time of analysis. However, the attack surface is high-value: the vulnerable function lies directly on the strip_comments=True path commonly used for SQL sanitization in web applications, meaning any endpoint that sanitizes user-provided SQL before logging or execution is potentially exposed without any special preconditions. The fix in 0.6.0 is a one-line algorithmic correction (adding a break when no terminator exists), making it straightforward to patch - but also trivial to verify and exploit. |
| Exploit ScenarioDerived | An attacker submits a crafted HTTP request containing a comment-only SQL string (e.g., '-- c\n' repeated thousands of times, roughly 250 KB) to any endpoint that passes user input through sqlparse.parse() or sqlparse.format(sql, strip_comments=True). A public proof-of-concept demonstrates the attack is trivially reproducible in Python. Each such request saturates a CPU core for tens of seconds to minutes, allowing a single attacker with modest throughput to maintain sustained denial of service against the application process. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 17, 2026
Quadratic CPU consumption in sqlparse's group_comments function (grouping.py) allows remote unauthenticated denial of service against any Python application that passes attacker-controlled input to sqlparse.parse() or sqlparse.format(sql, strip_comments=True). A comment-only payload of roughly 250 KB forces minutes of CPU burn regardless of the MAX_GROUPING_TOKENS guard, because group_comments executes before that cap is checked. A public proof-of-concept with benchmark data confirms O(n²) scaling: n=4000 comments takes ~1600 ms versus ~106 ms at n=1000; no public exploit identified at time of analysis beyond the researcher's PoC, and the vulnerability is not listed in CISA KEV.
RemediationAI
Vendor-released patch: sqlparse 0.6.0. Upgrade immediately via pip: pip install 'sqlparse>=0.6.0'. The fix is confirmed in commit ef2012a5eeb491e604dea2b00d516904a3830c87 (https://github.com/andialbrecht/sqlparse/commit/ef2012a5eeb491e604dea2b00d516904a3830c87), which breaks the quadratic loop early when no terminator token exists, reducing group_comments to O(n). Advisory: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-f2ff-p2ww-7p4p. If immediate upgrade is not possible, apply input length limits upstream: cap SQL input at a conservative byte size (e.g., 50 KB) before it reaches sqlparse.parse() or sqlparse.format(), since the vulnerability scales with comment count. Trade-off: hard length limits may reject legitimate large queries. An alternative compensating control is to run sqlparse calls in a subprocess or thread with a CPU timeout, terminating any call exceeding a defined threshold (e.g., 500 ms); this prevents full process saturation but adds latency overhead. Do not rely on MAX_GROUPING_TOKENS as a mitigation - it does not guard the group_comments code path.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
sqlparse (CPE: cpe:2.3:a:andialbrecht:sqlparse:*:*:*:*:*:*:*:*) is a non-validating Python SQL parser widely used for query formatting, sanitization, and introspection. CWE-400 (Uncontrolled Resource Consumption) applies: the root cause is an algorithmic complexity flaw in group_comments (sqlparse/engine/grouping.py lines 331-341). The function uses a while loop that runs n times over comment tokens, and inside each iteration calls token_next_by and token_not_matching, both of which rescan O(n) remaining tokens. For a comment-only statement, no tokens ever group, so every pass rescans the full tail, yielding O(n²) total work. Critically, group_comments is invoked first in the group() pipeline at line 439 - before the MAX_GROUPING_TOKENS guard at lines 34-39 - meaning the 10,000-token cap offers zero protection on this code path. Both sqlparse.parse() and sqlparse.format(sql, strip_comments=True) are affected. The latter sits on a primary sanitizer path used by query loggers, SQL firewalls, ORMs, and migration tooling, substantially widening the exposure surface.
Know when Sqlparse gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Network-reachable with no auth or complexity; sole impact is CPU exhaustion causing availability loss with no confidentiality or integrity consequence.
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, group_comments in sqlparse/engine/grouping.py repeatedly rescans comment-only statements before the MAX_GROUPING_TOKENS guard, causing quadratic CPU consumption through sqlparse.parse() and sqlparse.format(sql, strip_comments=True). This issue is fixed in version 0.6.0.
Blast Radius
ecosystem impact- 33 pypi packages depend on sqlparse (18 direct, 15 indirect)
Ecosystem-wide dependent count for version 0.6.0.
Articles & Coverage 1
Executive ViewAI
sqlparse, a widely-used Python library for SQL parsing, contains a denial-of-service vulnerability (CVE-2026-71491) that allows unauthenticated attackers to exhaust server CPU resources and render applications unavailable. Any Python application accepting user-supplied SQL input is exposed, with no vendor patch currently available to mitigate the risk.
Implement mandatory input validation and strict length limits on all SQL input before passing to sqlparse; deploy request rate limiting and throttling on SQL processing endpoints; execute sqlparse in resource-constrained containers with enforced CPU quotas and process timeouts; establish continuous monitoring for abnormal CPU consumption during SQL parsing operations and alert on threshold breaches.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Quadratic CPU consumption in sqlparse versions prior to 0.6.0 allows unauthenticated remote denial-of-service via crafte
CPU exhaustion via ReDoS in sqlparse affects all Python applications that pass caller-controlled SQL text to sqlparse.pa
Quadratic CPU exhaustion in sqlparse's reindentation path allows denial of service against any Python application that p
PHP code injection in sqlparse through 0.6.0 can turn crafted SQL text into executable PHP when an application uses the
sqlparse is a non-validating SQL parser module for Python. Rated high severity (CVSS 7.5), this vulnerability is remotel
sqlparse is a non-validating SQL parser module for Python. Rated high severity (CVSS 7.5), this vulnerability is remotel
Code injection in sqlparse prior to 0.6.0 allows attackers to escape generated Python and PHP source-code snippets by su
Same weakness CWE-400 – Uncontrolled Resource Consumption
View allSame technique Denial Of Service
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| openSUSE Tumbleweed | Fixed |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Affected |
| SUSE Manager Server 4.3 | Affected |
| SUSE Manager Proxy 4.3 | Affected |
| SUSE Manager Retail Branch Server 4.3 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP5 | Affected |
| SUSE Linux Enterprise Server 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP6 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Manager Proxy LTS 4.3 | Affected |
| SUSE Manager Retail Branch Server LTS 4.3 | Affected |
| SUSE Manager Server LTS 4.3 | Affected |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Server 16.0 | Affected |
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.0 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
| openSUSE Leap 16.0 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP4 | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP6 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP4 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP5 | Affected |
| SUSE Linux Enterprise Server 15 SP5 | Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Manager Proxy 4.3 | Affected |
| SUSE Manager Proxy 4.3 | Affected |
| SUSE Manager Proxy LTS 4.3 | Affected |
| SUSE Manager Retail Branch Server 4.3 | Affected |
| SUSE Manager Retail Branch Server 4.3 | Affected |
| SUSE Manager Retail Branch Server LTS 4.3 | Affected |
| SUSE Manager Server 4.3 | Affected |
| SUSE Manager Server 4.3 | Affected |
| SUSE Manager Server LTS 4.3 | Affected |
| SUSE CaaS Platform 4.0 | Affected |
| SUSE Enterprise Storage 6 | Affected |
| SUSE Enterprise Storage 7 | Affected |
| SUSE Enterprise Storage 7.1 | Affected |
| SUSE Linux Enterprise Desktop 15 SP1 | Affected |
| SUSE Linux Enterprise Desktop 15 SP2 | Affected |
| SUSE Linux Enterprise Desktop 15 SP4 | Affected |
| SUSE Linux Enterprise Desktop 15 SP5 | Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP1-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP2-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP3-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP3-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP1 | Affected |
| SUSE Linux Enterprise Module for Basesystem 15 SP2 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP1 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP2 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP3 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP4 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP6 | Affected |
| SUSE Linux Enterprise Module for Public Cloud 15 SP6 | Affected |
| SUSE Linux Enterprise Real Time 15 SP2 | Affected |
| SUSE Linux Enterprise Real Time 15 SP3 | Affected |
| SUSE Linux Enterprise Real Time 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP1 | Affected |
| SUSE Linux Enterprise Server 15 SP1-BCL | Affected |
| SUSE Linux Enterprise Server 15 SP1-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP2 | Affected |
| SUSE Linux Enterprise Server 15 SP2-BCL | Affected |
| SUSE Linux Enterprise Server 15 SP2-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP3-LTSS | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP1 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP2 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP3 | Affected |
| SUSE Manager Proxy 4.0 | Affected |
| SUSE Manager Proxy 4.1 | Affected |
| SUSE Manager Proxy 4.2 | Affected |
| SUSE Manager Retail Branch Server 4.0 | Affected |
| SUSE Manager Retail Branch Server 4.1 | Affected |
| SUSE Manager Retail Branch Server 4.2 | Affected |
| SUSE Manager Server 4.0 | Affected |
| SUSE Manager Server 4.1 | Affected |
| SUSE Manager Server 4.2 | Affected |
| openSUSE Leap 15.3 | Affected |
| openSUSE Leap 15.4 | Affected |
| openSUSE Leap 15.5 | Affected |
| openSUSE Leap 15.5 | Affected |
| openSUSE Leap 15.6 | Affected |
EUVD-2026-60309
GHSA-f2ff-p2ww-7p4p
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB