Description
sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, SQL_REGEX in sqlparse/keywords.py and the per-position loop in sqlparse/lexer.py repeatedly scan unmatched dollar-quoted literal and multiline-comment delimiters, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split(). This issue is fixed in version 0.6.0.
Published: 2026-08-17
Score: 7.5 High
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

sqlparse is a non‑validating SQL parser for Python. In versions prior to 0.6.0, the regular expression used to detect dollar‑quoted SQL literals together with a per‑position loop in the lexer repeatedly scans unmatched delimiters, causing quadratic CPU consumption when calling parse(), format(), or split(). The result is a ReDoS denial of service that can exhaust server resources, leading to service disruption. This flaw does not compromise confidentiality or integrity, but it threatens availability of Python applications that rely on sqlparse.

Affected Systems

The vulnerability affects the Python library sqlparse provided by the project and author andialbrecht. All releases before version 0.6.0 are impacted, including those used in scripts, frameworks, or databases that incorporate sqlparse for SQL handling.

Risk and Exploitability

The CVSS score of 7.5 indicates a medium‑to‑high severity. While the EPSS score is not available, the lack of listing in CISA KEV suggests that exploitation is not widely observed yet. The flaw is a regex‑based denial of service that requires an attacker to supply a malicious SQL string that triggers the quadratic scan. Based on the description, it is inferred that any API that calls parse(), format(), or split() with untrusted input can be abused to exhaust CPU resources, potentially impacting availability of the host application.

Generated by OpenCVE AI on August 17, 2026 at 18:23 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade sqlparse to version 0.6.0 or newer to eliminate the vulnerable regex logic.
  • Implement input filtering to limit the size and complexity of SQL strings passed to sqlparse, reducing the chance of triggering excessive CPU usage.
  • Add application‑level monitoring or rate limiting for CPU consumption when using sqlparse to detect and mitigate sudden spikes in resource usage.

Generated by OpenCVE AI on August 17, 2026 at 18:23 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-prg7-hcfm-mfcr sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service)
History

Mon, 17 Aug 2026 17:45:00 +0000

Type Values Removed Values Added
Description sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, SQL_REGEX in sqlparse/keywords.py and the per-position loop in sqlparse/lexer.py repeatedly scan unmatched dollar-quoted literal and multiline-comment delimiters, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split(). This issue is fixed in version 0.6.0.
Title sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service)
Weaknesses CWE-1333
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-08-17T17:41:36.621Z

Reserved: 2026-07-07T16:40:07.983Z

Link: CVE-2026-59893

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-17T18:17:35.730

Modified: 2026-08-17T18:17:35.730

Link: CVE-2026-59893

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-17T18:30:04Z

Weaknesses
  • CWE-1333

    Inefficient Regular Expression Complexity