CVE-2021-32839
mediumPriorität · verfolgen · 21EPSS 0.023 · 84. PerzentilEURUUSEPSS · bewertet 2026-10-28
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
Technischer Schweregrad, 0–10. Eine Zeile je Quelle.
Basiswert 0–10 · höher = schwerwiegender · Vektor überfahren zum Auflösen⚠ Quellen uneinig · medium–high · 5–7.5
schwächen
Die CWE-Schwächeklassen, zu denen dies gehört.
betroffene Produkte (8)
Betroffene Produkte und Versionsbereiche.
Advisories (2)
Hersteller- und Ökosystem-Meldungen dazu.
- GHSA-p5w8-wqhj-9hhfStripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)2021-09-10ghsa · osvUS
### 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` command line flag when using the `sqlformat` command line tool. ### References This issue was discovered by GitHub team members @erik-krogh and @yoff. It was found using a [CodeQL](https://codeql.github.com/) query which identifies inefficient regular expressions. You can see the results of the query on python-sqlparse by following [this link](https://lgtm.com/query/2223658096471222354/). ### For more information If you have any questions or comments about this advisory: * Open an issue in [sqlparse issue tracker](https://github.com/andialbrecht/sqlparse/issues) * Email us at [albrecht.andi@gmail.com](mailto:albrecht.andi@gmail.com)
- PYSEC-2021-3332021-09-20vendor · osvUS
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.
auch bekannt als (7)
Weitere Namen und Kennungen dieser Entität.
quellen
Welche Quellen diesen Datensatz belegen und wann.
Referenzen (14)
Externe Belege — Patches, Meldungen, Analysen.
- https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aebcnnvd
- https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhfcnnvd
- https://nvd.nist.gov/vuln/detail/CVE-2021-32839cnnvd
- https://packetstormsecurity.com/files/164258/Ubuntu-Security-Notice-USN-5085-1.htmlcnnvd
- https://packetstormsecurity.com/files/167709/Red-Hat-Security-Advisory-2022-5498-01.htmlcnnvd
- https://vigilance.fr/vulnerability/sqlparse-overload-via-Regular-Expression-36486cnnvd
- https://www.auscert.org.au/bulletins/ESB-2021.3199cnnvd
- https://www.auscert.org.au/bulletins/ESB-2021.4081cnnvd
Angreifer nutzen Schwachstellen wie diese gegen im Internet exponierte Dienste aus. Sehen Sie mit einem kostenlosen Passiv-Scan, was exponiert ist.
Kostenloser Scan