CVE-2021-32839: Regular Expression Denial of Service in sqlparse
Vulnerability summary
CVE-2021-32839 is a high (CVSS 7.5) Uncontrolled Resource Consumption vulnerability in andialbrecht sqlparse. EPSS estimates a 2.34% chance of exploitation in the next 30 days, higher than 83.6% of scored vulnerabilities.
Severe, CVSS 7.5 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 2% (FIRST, 03-11-2026)
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 4 · Related 2Timeline
- 20-09-2021PublishedVulnerability first disclosed.
- 03-11-2025Last modifiedVulnerability information updated.
Description
sqlparse is a non-validating SQL parser module for Python. In sqlparse versions 0.4.0 and 0.4.1 there is a regular Expression Denial of Service in sqlparse vulnerability. The regular expression may cause exponential backtracking on strings containing many repetitions of '\r\n' in SQL comments. Only the formatting feature that removes comments from SQL statements is affected by this regular expression. As a workaround don't use the sqlformat.format function with keyword strip_comments=True or the --strip-comments command line flag when using the sqlformat command line tool. The issues has been fixed in sqlparse 0.4.2.
CVSS metrics
8 scores · 6 sources · 3 versions- OSV · PypiEcosystem advisory · calculated7.5HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- OSV · UbuntuEcosystem advisory · calculated7.5HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- OSV · DebianEcosystem advisory · calculated7.5HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- NVDNIST7.5HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- OSV · AlpineEcosystem advisory · calculated7.5HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
EPSS trend
Probability
2.34%
Chance of exploitation in the next 30 days
Percentile
84%
Versus all other CVEs
30-day change
No change 0.00 pp
From 2.34% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Known conditions: network-reachable, no authentication, no user interaction (CVSS vector). Other conditions: not stated in public data.
Opensuse2 products
- python-sqlparse&distro=openSUSE Leap 15.3< 0.4.2-3.3.1
- python-sqlparse&distro=openSUSE Tumbleweed< 0.4.2-1.1
Alpine1 product
- py3-sqlparse< 0.4.2-r0
Andialbrecht1 product
- sqlparse≥ 0.4.0, < 0.4.2
Debian1 product
- sqlparse< 0.4.2-1
PyPI1 product
- sqlparse≥ 1499cffcd7c4d635b4297b44d48fb4fe94cf988e, < 8238a9e450ed1524e40cb3a8b0b3c00606903aeb | ≥ 0.4.0, < 0.4.2
Sqlparse_project1 product
- sqlparse≥ 0.4.0, < 0.4.2
Suse1 product
- python-sqlparse&distro=SUSE Linux Enterprise Module for Basesystem 15 SP3< 0.4.2-3.3.1
Ubuntu1 product
- sqlparse< 0.4.1-1ubuntu1
8 vendors · 9 products
References
16 links- github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhfX Refsource CONFIRMWEBAdvisoryREPORTThird Party Advisory
- github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aebX Refsource MISCWEBFIXPatchThird Party Advisory
Show all 16 references
- lists.opensuse.org/archives/…Advisory