Skip to main content

sqlparse EUVDEUVD-2026-60309

| CVE-2026-71491 HIGH
Uncontrolled Resource Consumption (CWE-400)
2026-08-17 GitHub_M GHSA-f2ff-p2ww-7p4p
8.7
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft comment-only SQL payload (~250 KB)
  2. Delivery
    Submit to network-exposed endpoint accepting SQL input
  3. Exploit
    Application invokes sqlparse.parse() or format(sql, strip_comments=True)
  4. Execution
    group_comments enters O(n²) rescan loop
  5. Persist
    CPU core saturated for minutes per request
  6. Impact
    Application 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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

sqlparse < 0.6.0

Affected Packages

pypi sqlparse fix: 0.6.0

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

Vendor (GitHub_M) PRIMARY 8.7 HIGH
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
vuln.today AI 7.5 HIGH

Network-reachable with no auth or complexity; sole impact is CPU exhaustion causing availability loss with no confidentiality or integrity consequence.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Red Hat 7.5 HIGH

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Aug 17, 2026 - 18:16 EUVD
CVE Published
Aug 17, 2026 - 17:16 cve.org
HIGH 8.7

DescriptionCVE.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
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 33 pypi packages depend on sqlparse (18 direct, 15 indirect)

Ecosystem-wide dependent count for version 0.6.0.

Executive ViewAI

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.3%
Top 82% exploitable
Prevalence
High
popular Python SQL parsing library, core dependency in Django debug tooling and ORMs
Threat Intel
1
1 sources
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Vendor 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

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy