Skip to content
Heist/ feed
Back to feed
HighFix available

sqlparse — security advisory

Type: advisorySources: OSVAdvisory ID: DEBIAN-CVE-2021-32839

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.

Products
sqlparse
Affected versions
Not specified
Fixed versions
0.4.2-1
CVEs
CVE-2021-32839
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 00:43 UTC · Revision 1

Source evidence

DEBIAN-CVE-2021-32839

core-osv · Original source

Published 20 Sept 2021, 17:15 UTC

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.

osv:DEBIAN-CVE-2021-32839

sqlparse

Fixed versions: 0.4.2-1

sqlparse

Fixed versions: 0.4.2-1

sqlparse

Fixed versions: 0.4.2-1

Complete source record
{
  "id": "46c2a844138b25c2296ef90456f2bd81a1bce0f6099a7758728c66e03575560c",
  "url": "https://osv.dev/vulnerability/DEBIAN-CVE-2021-32839",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DEBIAN-CVE-2021-32839",
    "summary": "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.",
    "evidence": "osv:DEBIAN-CVE-2021-32839",
    "products": [
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "0.4.2-1",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "0.4.2-1",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "0.4.2-1",
            "evidence": "/affected/2/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "DEBIAN-CVE-2021-32839",
      "aliases": [
        "DEBIAN-CVE-2021-32839"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "0.4.2-1"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/debian/sqlparse?arch=source&distro=bookworm",
            "ecosystem": "Debian:12"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2021-32839.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "0.4.2-1"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/debian/sqlparse?arch=source&distro=trixie",
            "ecosystem": "Debian:13"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2021-32839.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "0.4.2-1"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/debian/sqlparse?arch=source&distro=forky",
            "ecosystem": "Debian:14"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2021-32839.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        }
      ],
      "modified": "2026-10-23T18:03:37.615441216Z",
      "provider": "osv",
      "upstream": [
        "CVE-2021-32839"
      ],
      "references": [
        "https://security-tracker.debian.org/tracker/CVE-2021-32839"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2021-32839",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 422046,
  "published_at": "2021-09-20T17:15:09.067+00:00"
}