Skip to content
Heist/ feed
Back to feed
Medium

sqlparse — security advisory

Type: advisorySources: OSVAdvisory ID: UBUNTU-CVE-2026-84305

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse.format(sql, reindent=True) and sqlformat --reindent route attacker-controlled parenthesized tuple lists through ReindentFilter._get_offset() in sqlparse/filters/reindent.py, where _flatten_up_to_token() repeatedly rebuilds and joins the statement prefix. Thousands of offset calculations walk an expanding token tree, producing quadratic CPU consumption for inputs that remain below MAX_GROUPING_TOKENS and causing request delays, reduced throughput, or worker starvation. This issue is fixed in version 0.6.0.

Products
sqlparse
Affected versions
0.1.13-2ubuntu2, 0.1.18-1, 0.1.18-1ubuntu0.1~esm1, 0.2.2-1, 0.2.4-0.1, 0.2.4-0.1ubuntu0.1, 0.2.4-0.1ubuntu0.1+esm1, 0.2.4-1, 0.2.4-1build1, 0.2.4-2, 0.2.4-3, 0.2.4-3ubuntu0.1, 0.2.4-3ubuntu0.1+esm1, 0.4.1-1ubuntu1, 0.4.2-1, 0.4.2-1ubuntu0.22.04.1, 0.4.2-1ubuntu0.22.04.2, 0.4.2-1ubuntu0.22.04.3, 0.4.2-1ubuntu1, 0.4.4-1, 0.4.4-1ubuntu0.1, 0.4.4-1ubuntu0.2, 0.5.3-1, 0.5.4-1, 0.5.4-1ubuntu0.1, 0.5.5-2, 0.5.5-2ubuntu1
Fixed versions
Not specified
CVEs
CVE-2026-84305
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 03:22 UTC · Revision 1

Source evidence

UBUNTU-CVE-2026-84305

core-osv · Original source

Published 1 Sept 2026, 19:17 UTC

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse.format(sql, reindent=True) and sqlformat --reindent route attacker-controlled parenthesized tuple lists through ReindentFilter._get_offset() in sqlparse/filters/reindent.py, where _flatten_up_to_token() repeatedly rebuilds and joins the statement prefix. Thousands of offset calculations walk an expanding token tree, producing quadratic CPU consumption for inputs that remain below MAX_GROUPING_TOKENS and causing request delays, reduced throughput, or worker starvation. This issue is fixed in version 0.6.0.

osv:UBUNTU-CVE-2026-84305

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

sqlparse

Fixed versions: Not specified

Complete source record
{
  "id": "b2416cff523a6b765c7cc3479c73e6b4ab6bb92337596e263d3996d6c03d3612",
  "url": "https://osv.dev/vulnerability/UBUNTU-CVE-2026-84305",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "UBUNTU-CVE-2026-84305",
    "summary": "sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, sqlparse.format(sql, reindent=True) and sqlformat --reindent route attacker-controlled parenthesized tuple lists through ReindentFilter._get_offset() in sqlparse/filters/reindent.py, where _flatten_up_to_token() repeatedly rebuilds and joins the statement prefix. Thousands of offset calculations walk an expanding token tree, producing quadratic CPU consumption for inputs that remain below MAX_GROUPING_TOKENS and causing request delays, reduced throughput, or worker starvation. This issue is fixed in version 0.6.0.",
    "evidence": "osv:UBUNTU-CVE-2026-84305",
    "products": [
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.1.13-2ubuntu2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "0.1.18-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "0.1.18-1ubuntu0.1~esm1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.2.2-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "0.2.4-0.1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "0.2.4-0.1ubuntu0.1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "0.2.4-0.1ubuntu0.1+esm1",
            "evidence": "/affected/1/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.2.4-1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "0.2.4-1build1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "0.2.4-2",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "0.2.4-3",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "0.2.4-3ubuntu0.1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "0.2.4-3ubuntu0.1+esm1",
            "evidence": "/affected/2/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/3/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.4.1-1ubuntu1",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "0.4.2-1",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "0.4.2-1ubuntu0.22.04.1",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "0.4.2-1ubuntu0.22.04.2",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "0.4.2-1ubuntu0.22.04.3",
            "evidence": "/affected/3/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/4/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.4.2-1ubuntu1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "0.4.4-1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "0.4.4-1ubuntu0.1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "0.4.4-1ubuntu0.2",
            "evidence": "/affected/4/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/5/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.5.4-1",
            "evidence": "/affected/5/versions"
          },
          {
            "value": "0.5.5-2",
            "evidence": "/affected/5/versions"
          },
          {
            "value": "0.5.5-2ubuntu1",
            "evidence": "/affected/5/versions"
          }
        ]
      },
      {
        "name": {
          "value": "sqlparse",
          "evidence": "/affected/6/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "0.5.3-1",
            "evidence": "/affected/6/versions"
          },
          {
            "value": "0.5.4-1",
            "evidence": "/affected/6/versions"
          },
          {
            "value": "0.5.4-1ubuntu0.1",
            "evidence": "/affected/6/versions"
          }
        ]
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "UBUNTU-CVE-2026-84305",
      "aliases": [
        "UBUNTU-CVE-2026-84305"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
        },
        {
          "type": "Ubuntu",
          "score": "medium"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra-legacy%2Fxenial",
            "ecosystem": "Ubuntu:Pro:16.04:LTS"
          },
          "versions": [
            "0.1.13-2ubuntu2",
            "0.1.18-1",
            "0.1.18-1ubuntu0.1~esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "pypy-sqlparse",
                "binary_version": "0.1.18-1ubuntu0.1~esm1"
              },
              {
                "binary_name": "python-sqlparse",
                "binary_version": "0.1.18-1ubuntu0.1~esm1"
              },
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.1.18-1ubuntu0.1~esm1"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.1.18-1ubuntu0.1~esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra%2Fbionic",
            "ecosystem": "Ubuntu:Pro:18.04:LTS"
          },
          "versions": [
            "0.2.2-1",
            "0.2.4-0.1",
            "0.2.4-0.1ubuntu0.1",
            "0.2.4-0.1ubuntu0.1+esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "pypy-sqlparse",
                "binary_version": "0.2.4-0.1ubuntu0.1+esm1"
              },
              {
                "binary_name": "python-sqlparse",
                "binary_version": "0.2.4-0.1ubuntu0.1+esm1"
              },
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.2.4-0.1ubuntu0.1+esm1"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.2.4-0.1ubuntu0.1+esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=esm-infra%2Ffocal",
            "ecosystem": "Ubuntu:Pro:20.04:LTS"
          },
          "versions": [
            "0.2.4-1",
            "0.2.4-1build1",
            "0.2.4-2",
            "0.2.4-3",
            "0.2.4-3ubuntu0.1",
            "0.2.4-3ubuntu0.1+esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "pypy-sqlparse",
                "binary_version": "0.2.4-3ubuntu0.1+esm1"
              },
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.2.4-3ubuntu0.1+esm1"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.2.4-3ubuntu0.1+esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=jammy",
            "ecosystem": "Ubuntu:22.04:LTS"
          },
          "versions": [
            "0.4.1-1ubuntu1",
            "0.4.2-1",
            "0.4.2-1ubuntu0.22.04.1",
            "0.4.2-1ubuntu0.22.04.2",
            "0.4.2-1ubuntu0.22.04.3"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.4.2-1ubuntu0.22.04.3"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.4.2-1ubuntu0.22.04.3"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=noble",
            "ecosystem": "Ubuntu:24.04:LTS"
          },
          "versions": [
            "0.4.2-1ubuntu1",
            "0.4.4-1",
            "0.4.4-1ubuntu0.1",
            "0.4.4-1ubuntu0.2"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.4.4-1ubuntu0.2"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.4.4-1ubuntu0.2"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=stonking",
            "ecosystem": "Ubuntu:26.10"
          },
          "versions": [
            "0.5.4-1",
            "0.5.5-2",
            "0.5.5-2ubuntu1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.5.5-2ubuntu1"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.5.5-2ubuntu1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "sqlparse",
            "purl": "pkg:deb/ubuntu/sqlparse?arch=source&distro=resolute",
            "ecosystem": "Ubuntu:26.04:LTS"
          },
          "versions": [
            "0.5.3-1",
            "0.5.4-1",
            "0.5.4-1ubuntu0.1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-84305.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "python3-sqlparse",
                "binary_version": "0.5.4-1ubuntu0.1"
              },
              {
                "binary_name": "sqlformat",
                "binary_version": "0.5.4-1ubuntu0.1"
              }
            ]
          }
        }
      ],
      "modified": "2026-10-17T13:01:12.462103282Z",
      "provider": "osv",
      "upstream": [
        "CVE-2026-84305"
      ],
      "references": [
        "https://ubuntu.com/security/CVE-2026-84305",
        "https://www.cve.org/CVERecord?id=CVE-2026-84305",
        "https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-cfqr-cjx5-5jcm"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2026-84305",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 361237,
  "published_at": "2026-09-01T19:17:00+00:00"
}