{"cve":"CVE-2021-32839","nvd":{"published":"2021-09-20T17:15:09.067","modified":"2026-06-17T03:53:44.140","status":"Modified","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_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5},"cwes":["CWE-400"],"references":["https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aeb","https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf","https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aeb","https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf","https://lists.debian.org/debian-lts-announce/2024/12/msg00022.html"],"products":["sqlparse_project:sqlparse"],"source":"nvd","synced_at":"2026-10-19T21:23:41.316049955+00:00"},"epss":{"cve":"CVE-2021-32839","score":0.02339,"percentile":0.83611,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-p5w8-wqhj-9hhf","url":"https://osv.dev/vulnerability/GHSA-p5w8-wqhj-9hhf","summary":"StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)","modified":"2026-07-08T06:29:57.075283258Z","packages":[{"ecosystem":"PyPI","name":"sqlparse","purl":"pkg:pypi/sqlparse","ranges":[">=0.4.0 <0.4.2"],"fixed":["0.4.2"]}]},{"id":"PYSEC-2021-333","url":"https://osv.dev/vulnerability/PYSEC-2021-333","summary":"","modified":"2023-11-08T04:06:01.984949Z","packages":[{"ecosystem":"PyPI","name":"sqlparse","purl":"pkg:pypi/sqlparse","ranges":[">=0.4.0 <0.4.2"],"fixed":["0.4.2"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}