Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. sqlparse
  4. ›
  5. CVE-2021-32839

CVE-2021-32839: StripComments filter contains a regular expression that is vulnerable to ReDOS (Regular Expression Denial of Service)

September 10, 2021 (updated October 28, 2024)

The formatter function that strips comments from a SQL contains a regular expression that is vulnerable to ReDoS (Regular Expression Denial of Service). The regular expression may cause exponential backtracking on strings containing many repetitions of ‘\r\n’ in SQL comments.

References

  • github.com/advisories/GHSA-p5w8-wqhj-9hhf
  • github.com/andialbrecht/sqlparse
  • github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aeb
  • github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf
  • github.com/pypa/advisory-database/tree/main/vulns/sqlparse/PYSEC-2021-333.yaml
  • nvd.nist.gov/vuln/detail/CVE-2021-32839
  • securitylab.github.com/advisories/GHSL-2021-107-andialbrecht-sqlparse

Code Behaviors & Features

Detect and mitigate CVE-2021-32839 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.4.0 before 0.4.2

Fixed versions

  • 0.4.2

Solution

Upgrade to version 0.4.2 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-400: Uncontrolled Resource Consumption

Source file

pypi/sqlparse/CVE-2021-32839.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:01 +0000.