Vulnerability · Published Aug 17, 2026 · Assigned by GitHub_M

CVE-2026-71491sqlparse: Quadratic O(n²) DoS in group_comments

High 8.7

In plain English

A high-severity uncontrolled resource consumption in sqlparse from andialbrecht. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 18% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 4.0)8.7High
Exploit odds (30 days)0.3%top 81.8% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12sqlparseno fix listedDEBIAN-CVE-2026-71491
Debian:13sqlparseno fix listedDEBIAN-CVE-2026-71491
Debian:14sqlparseno fix listedDEBIAN-CVE-2026-71491
PyPIsqlparse0.6.0PYSEC-2026-3697
PyPIsqlparse0.6.0GHSA-f2ff-p2ww-7p4p
Ubuntu:22.04:LTSsqlparse0.4.2-1ubuntu0.22.04.3USN-8808-1
Ubuntu:22.04:LTSsqlparse0.4.2-1ubuntu0.22.04.3UBUNTU-CVE-2026-71491
Ubuntu:24.04:LTSsqlparse0.4.4-1ubuntu0.2UBUNTU-CVE-2026-71491
Ubuntu:24.04:LTSsqlparse0.4.4-1ubuntu0.2USN-8808-1
Ubuntu:26.04:LTSsqlparse0.5.4-1ubuntu0.1UBUNTU-CVE-2026-71491
Ubuntu:26.04:LTSsqlparse0.5.4-1ubuntu0.1USN-8808-1

Affected products (as reported)

VendorProductVersions
andialbrecht sqlparse < 0.6.0

Weakness: CWE-400, CWE-407 · Vector: 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

References