CVE-2021-32839
published 2021-09-20CVE-2021-32839: 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…
PriorityP341high7.5CVSS 3.1
AVNACLPRNUINSUCNINAH
EPSS
2.13%
79.7th percentile
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.
Affected
8 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| andialbrecht | sqlparse | — | — |
| debian | sqlparse | < sqlparse 0.4.2-1 (bookworm) | sqlparse 0.4.2-1 (bookworm) |
| sqlparse_project | sqlparse | >= 0 < 0.4.1-1+deb11u1 | 0.4.1-1+deb11u1 |
| sqlparse_project | sqlparse | >= 0 < 0.4.2-1 | 0.4.2-1 |
| sqlparse_project | sqlparse | >= 0 < 0.4.2-1 | 0.4.2-1 |
| sqlparse_project | sqlparse | >= 0 < 0.4.2-1 | 0.4.2-1 |
| sqlparse_project | sqlparse | >= 0.4.0 < 0.4.2 | 0.4.2 |
| sqlparse_project | sqlparse | >= 0.4.0 < 0.4.2 | 0.4.2 |
CVSS provenance
nvdv3.17.5HIGHCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
nvdv2.05.0MEDIUMAV:N/AC:L/Au:N/C:N/I:N/A:P
osv7.5HIGH
vendor_debian7.5HIGH
vendor_redhat7.5HIGH
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
OSV
CVE-2021-32839: sqlparse is a non-validating SQL parser module for Python
osv·2021-09-20·CVSS 7.5
CVE-2021-32839 [HIGH] CVE-2021-32839: sqlparse is a non-validating SQL parser module for Python
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.
OSV
StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
osv·2021-09-10
CVE-2021-32839 [HIGH] StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
### Impact
The formatter function that strips comments from a SQL contains a regular expression that is vulnerable to [ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) (Regular Expression Denial of Service). The regular expression may cause exponential backtracking on strings containing many repetitions of '\r\n' in SQL comments.
### Patches
The issues has been fixed in sqlparse 0.4.2.
### Workarounds
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` c
GHSA
StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
ghsa·2021-09-10
CVE-2021-32839 [HIGH] CWE-400 StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)
### Impact
The formatter function that strips comments from a SQL contains a regular expression that is vulnerable to [ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) (Regular Expression Denial of Service). The regular expression may cause exponential backtracking on strings containing many repetitions of '\r\n' in SQL comments.
### Patches
The issues has been fixed in sqlparse 0.4.2.
### Workarounds
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` c
Ubuntu
SQL parse vulnerability
vendor_ubuntu·2021-09-22
CVE-2021-32839 SQL parse vulnerability
Title: SQL parse vulnerability
Summary: SQL parse could be made to denial of service if it received a specially
crafted regular expression.
It was discovered that SQL parse incorrectly handled certain regular expression.
An attacker could possibly use this issue to cause a denial of service.
Instructions: In general, a standard system update will make all the necessary changes.
Red Hat
python-sqlparse: ReDoS via regular expression in StripComments filter
vendor_redhat·2021-09-10·CVSS 7.5
CVE-2021-32839 [HIGH] CWE-400 python-sqlparse: ReDoS via regular expression in StripComments filter
python-sqlparse: ReDoS via regular expression in StripComments filter
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.
A resource-consumption flaw was found in python-sqlparse. The formatter function that strips comments f
Debian
CVE-2021-32839: sqlparse - sqlparse is a non-validating SQL parser module for Python. In sqlparse versions ...
vendor_debian·2021·CVSS 7.5
CVE-2021-32839 [HIGH] CVE-2021-32839: sqlparse - sqlparse is a non-validating SQL parser module for Python. In sqlparse versions ...
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.
Scope: local
bookworm: resolved (fixed in 0.4.2-1)
bullseye: resolved (fixed in 0.4.1-1+deb11u1)
forky: resolved (fixed in 0.4.2-1)
sid: resolved (fixed in 0.4.2-1)
trixie: re
No detection rules found.
No public exploits indexed.
No writeups or analysis indexed.
https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aebhttps://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhfhttps://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aebhttps://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhfhttps://lists.debian.org/debian-lts-announce/2024/12/msg00022.html
2021-09-20
Published