sqlparse contains a regular expression that is vulnerable to Regular Expression Denial of Service
Published 21 Apr 2023 · Updated 4 Nov 2025
Is your project on an affected sqlparse?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=0.1.15 <0.4.4
- Fixed in
- 0.4.4
pip install 'sqlparse>=0.4.4'Details
Impact
The SQL parser contains a regular expression that is vulnerable to ReDoS (Regular Expression Denial of Service). The vulnerability may lead to Denial of Service (DoS).
Patches
This issues has been fixed in sqlparse 0.4.4.
Workarounds
None.
References
This issue was discovered and reported by GHSL team member @erik-krogh (Erik Krogh Kristensen).
- Commit that introduced the vulnerability: e75e35869473832a1eb67772b1adfee2db11b85a
Is GHSA-rrm6-wvj7-cwh2 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected sqlparse, and gives you the command that fixes it.
More advisories for sqlparse
- MediumCVE-2026-84305sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption · 1 Sept 2026
- HighCVE-2026-59893sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service) · 17 Aug 2026
- HighCVE-2026-54284sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger · 17 Aug 2026
- HighCVE-2026-71491sqlparse: Quadratic O(n²) DoS in group_comments · 17 Aug 2026
- MediumCVE-2026-59894sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes · 17 Aug 2026
- MediumGHSA-27jp-wm6q-gp25sqlparse: formatting list of tuples leads to denial of service · 13 Feb 2026
References
- Linkgithub.com/andialbrecht/sqlparse/security/advisories/GHSA-rrm6-wvj7-cwh2
- Advisorynvd.nist.gov/vuln/detail/CVE-2023-30608
- Linkgithub.com/andialbrecht/sqlparse/commit/c457abd5f097dd13fb21543381e7cfafe7d31cfb
- Linkgithub.com/andialbrecht/sqlparse/commit/e75e35869473832a1eb67772b1adfee2db11b85a
- Packagegithub.com/andialbrecht/sqlparse
- Linkgithub.com/pypa/advisory-database/tree/main/vulns/sqlparse/PYSEC-2023-87.yaml
- Linklists.debian.org/debian-lts-announce/2023/05/msg00017.html
- Linklists.debian.org/debian-lts-announce/2024/12/msg00022.html
- Linkowasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.