Security readout for executives and security teams
Plain-English summary
sqlparse 0.4.0 and 0.4.1 can be forced to spend excessive CPU when removing SQL comments. An attacker who can submit crafted SQL text to a service using that feature could cause denial of service. The issue is fixed in sqlparse 0.4.2.
Executive priority
Treat as high priority for services that accept user-controlled SQL and perform formatting. For internal-only tools without untrusted input, urgency is lower but still remediate through normal dependency management.
Technical view
The flaw is a Regular Expression Denial of Service in sqlparse comment stripping. The vulnerable regex can exponentially backtrack on SQL comments containing many repeated CRLF sequences. Sources state only sqlparse formatting with strip_comments=True, or sqlformat with --strip-comments, is affected.
Likely exposure
Exposure is likely where Python applications use sqlparse versions 0.4.0 or 0.4.1 and process untrusted SQL through comment-stripping formatting. General parsing or formatting without comment removal is not identified as affected in the provided sources.
Exploitation context
The CVE has CVSS 7.5 for network-reachable, unauthenticated availability impact, but the bundle does not cite active exploitation and KEV is false. Evidence supports denial-of-service risk, not confidentiality or integrity impact.
Researcher notes
The affected range and workaround are clear from the advisory. The provided evidence does not show exploitation in the wild. Validation should focus on the narrow affected feature, because the advisory says only comment-stripping formatting is impacted.
Mitigation direction
- Upgrade sqlparse to version 0.4.2 or later.
- Disable strip_comments=True where upgrade is not immediately possible.
- Avoid sqlformat --strip-comments on untrusted SQL input.
- Check downstream distribution advisories for packaged sqlparse updates.
- Prioritize exposed services that format user-supplied SQL.
Validation and detection
- Inventory Python dependencies for sqlparse 0.4.0 or 0.4.1.
- Review code paths using sqlparse.format with strip_comments=True.
- Review jobs or tooling invoking sqlformat with --strip-comments.
- Confirm production packages resolve to sqlparse 0.4.2 or later.
- Document whether untrusted users can reach comment-stripping functionality.
Public sources used
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
CWE-400: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Open ATT&CK lookupCVE-2021-32839 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
Open ATT&CK lookup- Severity
- High
- CVSS
- 7.5 (3.1)
- Known Exploited
- No
- Published
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CNA and ADP enrichment extracted from CVE v5
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
CVSS vector scores
1 official scoreWe collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H3.93.6Primary CVE scoreVulnerability scoring details
Base CVSS 3.1 score
7.5HighVector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Source materials
- CVE List V5 sourceCVE List V5
- https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhfCVE reference · x_refsource_CONFIRM
- https://github.com/andialbrecht/sqlparse/commit/8238a9e450ed1524e40cb3a8b0b3c00606903aebCVE reference · x_refsource_MISC
- https://lists.debian.org/debian-lts-announce/2024/12/msg00022.htmlCVE reference
Products and packages named in the record
CWE details
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
