
Cloud Vulnerability DB
A community-led vulnerabilities database
A critical Regular Expression Denial of Service (ReDoS) vulnerability was discovered in python-sqlparse versions 0.4.0 and 0.4.1. The vulnerability, identified as CVE-2021-32839, affects the formatter function that strips comments from SQL statements. The issue was discovered in August 2021 and publicly disclosed in September 2021, affecting the SQL parsing functionality in Python applications using this library (GitHub Advisory, GitHub Lab).
The vulnerability exists in the regular expression used for identifying line breaks in comments within the StripComments filter. The problematic regex pattern (( | | )+) *$ could cause exponential backtracking when processing strings containing multiple repetitions of '\r\n' in SQL comments. The issue was fixed in commit 8238a9e by optimizing the regular expression to (( | )+) *$ (GitHub Commit).
The vulnerability could lead to a denial of service condition when processing specially crafted SQL comments. When the strip_comments feature is enabled, an attacker could potentially exploit this vulnerability by submitting SQL statements with specifically formatted comments, causing the application to become unresponsive due to the exponential processing time required (GitHub Advisory, Ubuntu Notice).
The vulnerability was patched in python-sqlparse version 0.4.2. For users unable to upgrade immediately, the recommended workaround is to avoid using the sqlformat.format function with the strip_comments=True parameter or the --strip-comments command line flag in the sqlformat command line tool (GitHub Advisory).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."