Search
Find a vulnerability
Search criteria
Related vulnerabilities
UBUNTU-CVE-2021-32839 (CVE-2021-32839)
Vulnerability from osv_ubuntu – Published: 2021-09-20 17:15 – Updated: 2025-09-08 16:47 – Source website
VLAI
Details
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.
Upstream
Related
Severity
7.5 (High)
7.5 (High)
N/A (UNKNOWN)
References
4 references
Impacted products
1 product
| Ecosystem | Package | Version |
|---|---|---|
| Ubuntu:22.04:LTS |
sqlparse
pkg:deb/ubuntu/sqlparse@0.4.1-1ubuntu1?arch=source&distro=jammy
|
Affected: < 0.4.1-1ubuntu1 (ecosystem)
|
{
"affected": [
{
"ecosystem_specific": {
"availability": "No subscription required",
"binaries": [
{
"binary_name": "python3-sqlparse",
"binary_version": "0.4.1-1ubuntu1"
},
{
"binary_name": "sqlformat",
"binary_version": "0.4.1-1ubuntu1"
}
]
},
"package": {
"ecosystem": "Ubuntu:22.04:LTS",
"name": "sqlparse",
"purl": "pkg:deb/ubuntu/sqlparse@0.4.1-1ubuntu1?arch=source\u0026distro=jammy"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.1-1ubuntu1"
}
],
"type": "ECOSYSTEM"
}
],
"versions": []
}
],
"aliases": [],
"details": "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 \u0027\\r\\n\u0027 in SQL comments. Only the formatting feature that removes comments from SQL statements is affected by this regular expression. As a workaround don\u0027t 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.",
"id": "UBUNTU-CVE-2021-32839",
"modified": "2025-09-08T16:47:10Z",
"published": "2021-09-20T17:15:00Z",
"references": [
{
"type": "REPORT",
"url": "https://ubuntu.com/security/CVE-2021-32839"
},
{
"type": "REPORT",
"url": "https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-p5w8-wqhj-9hhf"
},
{
"type": "ADVISORY",
"url": "https://ubuntu.com/security/notices/USN-5085-1"
},
{
"type": "REPORT",
"url": "https://www.cve.org/CVERecord?id=CVE-2021-32839"
}
],
"related": [
"USN-5085-1"
],
"schema_version": "1.7.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
},
{
"score": "medium",
"type": "Ubuntu"
}
],
"upstream": [
"CVE-2021-32839"
]
}