Skip to main content

sqlparse CVE-2026-54284

| EUVDEUVD-2026-60313 HIGH
Inefficient Algorithmic Complexity (CWE-407)
2026-08-17 GitHub_M GHSA-pwgv-4x5q-6m9f
8.7
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Recon
    Craft 2KB deeply-nested SQL payload
  2. Delivery
    Submit to application's SQL parsing endpoint
  3. Exploit
    Application calls sqlparse.parse() on input
  4. Install
    TokenList.__init__ triggers O(n×depth) subtree flattening per group
  5. C2
    CPU saturated for ~10 seconds per request
  6. Execute
    Send concurrent requests
  7. Impact
    Worker pool exhausted, service unavailable

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V2 - Validation and Business Logic Algorithmic complexity limits
Exploitation Conditions

The application must pass attacker-controlled SQL strings directly to sqlparse.parse(), sqlparse.format(), or sqlparse.split() without prior input length or nesting-depth validation. The attack is triggered by deeply nested parenthesis groups (e.g., 500-2000 levels of SELECT (((...)))) or equivalently deep nested CASE WHEN chains in inputs of approximately 1-2KB. No special configuration of sqlparse is required - the vulnerability exists in the default TokenList construction path active in all parsing operations. Exploitation is limited to availability impact only; there is no code execution, authentication bypass, or data exfiltration component. Deployments that do not expose SQL parsing to untrusted input (e.g., internal tooling processing only developer-authored queries) are not realistically at risk.

Impact

The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N/VA:H) accurately reflects the severity: any network-reachable application that passes user-controlled SQL strings to sqlparse is exploitable with no authentication, low complexity, and no user interaction. The 5000x CPU amplification per 2KB input is an unusually high ratio that threatens multi-tenant services and API gateways; even a mid-sized municipal IT team in tczew running a SQL formatting or linting service on a single worker process should treat this as urgent given that one concurrent malicious request can saturate a core for ~10 seconds. No EPSS data is included in the provided intelligence, and this CVE has no CISA KEV listing, so widespread automated exploitation is not confirmed - but the exploit is trivially constructable from the public GHSA advisory. The discrepancy to watch is that the existing depth/token caps may create a false sense of protection in unpatched deployments; operators who applied only the GHSA-2m57-hf25-phgg or GHSA-27jp-wm6q-gp25 fixes without upgrading to 0.6.0 remain vulnerable to this distinct quadratic path.

Exploit ScenarioDerived

An attacker submits a ~2KB HTTP request body containing SQL of the form SELECT (((((1))))) ... with 500-2000 levels of parenthesis nesting to any public-facing API endpoint that internally calls sqlparse.parse() or sqlparse.format() on user-supplied input. The server process consumes approximately 10 seconds of CPU per such request, and sending a small number of concurrent requests can saturate all available worker threads, causing a full denial of service. The GHSA advisory provides sufficient detail for a working proof-of-concept to be constructed from the public description alone.

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 versions prior to 0.6.0 allows unauthenticated remote denial-of-service via crafted deeply-nested SQL payloads submitted to any application calling sqlparse.parse(), sqlparse.format(), or sqlparse.split(). A ~2KB malicious input with 500-2000 nesting levels can consume approximately 10 seconds of CPU per request - a ~5000x amplification ratio - before depth or token limits raise a SQLParseError. No active exploitation is confirmed in CISA KEV, though the GHSA advisory includes a detailed proof-of-concept demonstrating the attack; CVSS 4.0 rates availability impact as High (8.7) with no authentication required.

RemediationAI

Upgrade sqlparse to version 0.6.0 or later, which resolves the issue by replacing the O(subtree) str(self) call in TokenList.__init__ with a shallow join over only immediate child token values: ''.join(token.value for token in self.tokens). The fix is confirmed in commit 939b129e24c0ad5d51368b1aa72fffcaca76f06f at https://github.com/andialbrecht/sqlparse/commit/939b129e24c0ad5d51368b1aa72fffcaca76f06f. Run pip install 'sqlparse>=0.6.0' and pin accordingly. If immediate upgrade is not possible, the most specific compensating control is to enforce input length limits (e.g., reject SQL inputs exceeding 500 bytes or 50 nesting levels) in the application layer before passing strings to any sqlparse API - this reduces amplification but does not eliminate the quadratic behavior. Rate-limiting requests to SQL-parsing endpoints per client IP is a secondary control that limits blast radius without eliminating the underlying flaw. Neither workaround should substitute for upgrading.

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 is a non-validating Python SQL parser (CPE: cpe:2.3:a:andialbrecht:sqlparse:*:*:*:*:*:*:*:*) used extensively in data tooling, ORMs, and SQL formatting pipelines. The root cause is CWE-407 (Inefficient Algorithmic Complexity): in sqlparse/sql.py, the TokenList.__init__ constructor calls super().__init__(None, str(self)), where __str__ recursively flattens the entire subtree via flatten() on every invocation. Because the parser constructs a new TokenList for every parenthesis group, CASE WHEN chain, and list group during the grouping phase, a tree of depth d with n total tokens incurs O(n*d) string-concatenation work purely for materializing the cached value field - a field that grouped nodes never subsequently read, as they override __str__ independently. While GHSA-2m57-hf25-phgg previously added MAX_GROUPING_DEPTH=100 and MAX_GROUPING_TOKENS=10000 caps to bound unbounded growth, the work performed before those caps trigger remains superlinear in payload size, leaving the protection incomplete.

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 interaction required; only availability is impacted as there is no data exposure or modification possible.

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 - 19:18 EUVD
CVE Published
Aug 17, 2026 - 17:43 cve.org
HIGH 8.7

DescriptionCVE.org

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. 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 SQL parsing library, faces an unauthenticated, high-severity denial-of-service vulnerability (CVE-2026-54284, CVSS 8.7) with publicly available exploit code that allows attackers to trigger CPU exhaustion-a 5000x amplification ratio where 2KB requests consume 10+ seconds of processing time. Any application integrating sqlparse for query handling faces immediate availability risk to customer-facing systems and data processing pipelines. Organizations must urgently assess their sqlparse deployment footprint and deploy input validation controls to limit exposure until a vendor patch becomes available.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: enforce strict input validation (reject nesting depth exceeding 100 levels, enforce payload size limits below 1MB), rate-limit SQL parsing requests to a maximum of 10 per second per source IP, monitor CPU utilization on parsing workloads with alerts above 80% baseline, and segment parsing services to dedicated resource pools with hard CPU quotas to prevent cascading denial-of-service impacts on other services.

Threat Intelligence Overview

EPSS Score
0.3%
Top 82% exploitable
Prevalence
High
widely-used Python SQL parsing library across data and ORM tooling
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
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 Yes
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
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

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

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

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