CVE-2021-32839
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.
Predictions
Heuristic predictions, AS-IS, for prioritization only.
Mitigations
No mitigations published for this CVE yet.
The vendor-content worker queues fetches as references arrive (check back in a few minutes). Or โ if you've already worked around this in production โ publish your fix to the community-verified tier.
โ Propose a mitigation on Community โ Mitigations published via the community go through AI scoring + 2 human reviewers + 7-day silent objection window before landing here withsource_tier=community-verified.
OS impact
| OS | Version | Status | Fixed in |
|---|---|---|---|
| arch | fixed | 0.4.2-1 | |
| sles | affected | | |
| rocky | 8 | fixed | |
| debian | bookworm | fixed | 0.4.2-1 |
| debian | bullseye | fixed | 0.4.1-1+deb11u1 |
| debian | forky | fixed | 0.4.2-1 |
| debian | sid | fixed | 0.4.2-1 |
| debian | trixie | fixed | 0.4.2-1 |
References
- https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf
- https://nvd.nist.gov/vuln/detail/CVE-2021-32839
- https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aeb
- https://github.com/andialbrecht/sqlparse
- https://github.com/pypa/advisory-database/tree/main/vulns/sqlparse/PYSEC-2021-333.yaml
- https://lists.debian.org/debian-lts-announce/2024/12/msg00022.html
- https://securitylab.github.com/advisories/GHSL-2021-107-andialbrecht-sqlparse
- https://www.suse.com/security/cve/CVE-2021-32839.html
- https://errata.rockylinux.org/RLSA-2022:5498
- https://security-tracker.debian.org/tracker/CVE-2021-32839
Community-verified mitigations for this CVE will appear above when contributors publish them.
Verify integrity in audit chain (admin only). AS-IS.