CVE-2021-32839
Regular Expression Denial of Service in sqlparse
Severity Score
Exploit Likelihood
Affected Versions
Public Exploits
0Exploited in Wild
-Decision
Descriptions
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
' 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.
sqlparse es un módulo analizador de SQL no comprobable para Python. En las versiones 0.4.0 y 0.4.1 de sqlparse, se presenta una vulnerabilidad de Denegación de Servicio por Expresión regular en sqlparse. La expresión regular puede causar un retroceso exponencial en las cadenas que contienen muchas repeticiones de "\r
" en los comentarios SQL. Sólo la función de formato que elimina los comentarios de las sentencias SQL esta afectada por esta expresión regular. Como solución, no use la función sqlformat.format con la palabra clave strip_comments=True o el indicador de línea de comandos --strip-comments cuando use la herramienta de línea de comandos sqlformat. Este problema ha sido corregido en sqlparse versión 0.4.2
A resource-consumption flaw was found in python-sqlparse. The formatter function that strips comments from SQL contains a regular expression that is vulnerable to Regular Expression Denial of Service (ReDoS). A network attacker could craft an SQL comment containing numerous repetitions of '\r
' that could cause exponential backtracking and cause the system to hang.
CVSS Scores
SSVC
- Decision:-
Timeline
- 2021-05-12 CVE Reserved
- 2021-09-20 CVE Published
- 2024-06-05 EPSS Updated
- 2024-08-03 CVE Updated
- ---------- Exploited in Wild
- ---------- KEV Due Date
- ---------- First Exploit
CWE
- CWE-400: Uncontrolled Resource Consumption
CAPEC
References (4)
URL | Tag | Source |
---|---|---|
https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf | Third Party Advisory |
URL | Date | SRC |
---|
URL | Date | SRC |
---|---|---|
https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aeb | 2021-09-29 |
URL | Date | SRC |
---|---|---|
https://access.redhat.com/security/cve/CVE-2021-32839 | 2022-07-05 | |
https://bugzilla.redhat.com/show_bug.cgi?id=2005072 | 2022-07-05 |
Affected Vendors, Products, and Versions
Vendor | Product | Version | Other | Status | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Vendor | Product | Version | Other | Status | <-- --> | Vendor | Product | Version | Other | Status |
Sqlparse Project Search vendor "Sqlparse Project" | Sqlparse Search vendor "Sqlparse Project" for product "Sqlparse" | >= 0.4.0 < 0.4.2 Search vendor "Sqlparse Project" for product "Sqlparse" and version " >= 0.4.0 < 0.4.2" | - |
Affected
|