Skip to content
Heist/ feed
Back to feed
High

sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger

Type: advisorySources: OSV

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-54284
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 04:43 UTC · Revision 1

Source evidence

sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger

core-osv · Original source

Published 17 Aug 2026, 17:43 UTC

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.

osv:CVE-2026-54284
Complete source record
{
  "id": "e9cb0076b2142127c329fd6cc5962c4777481725057134a8897798195b9265e3",
  "url": "https://osv.dev/vulnerability/CVE-2026-54284",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger",
    "summary": "sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.",
    "evidence": "osv:CVE-2026-54284",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2026-54284",
      "aliases": [
        "CVE-2026-54284",
        "GHSA-pwgv-4x5q-6m9f",
        "PYSEC-2026-3699"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/andialbrecht/sqlparse",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "2f40da99b50d81135aecf96f6b08fcfa338a96de"
                },
                {
                  "fixed": "939b129e24c0ad5d51368b1aa72fffcaca76f06f"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.6.0"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "939b129e24c0ad5d51368b1aa72fffcaca76f06f"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "0.5.5",
            "0.5.4",
            "0.5.3",
            "0.5.2",
            "0.5.1",
            "0.5.0",
            "0.4.4",
            "0.4.3",
            "0.4.2",
            "0.4.1",
            "0.4.0",
            "0.3.1",
            "0.3.0",
            "0.2.4",
            "0.2.3",
            "0.2.2",
            "0.2.1",
            "0.2.0",
            "0.1.18",
            "0.1.17",
            "0.1.16",
            "0.1.15",
            "0.1.14",
            "0.1.13",
            "0.1.12",
            "0.1.11",
            "0.1.10",
            "0.1.9",
            "0.1.8",
            "0.1.7",
            "0.1.6",
            "0.1.5",
            "0.1.3",
            "0.1.2",
            "0.1.1",
            "0.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-54284.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:25.689381260Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54284.json",
        "https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-pwgv-4x5q-6m9f",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-54284",
        "https://github.com/andialbrecht/sqlparse/commit/939b129e24c0ad5d51368b1aa72fffcaca76f06f"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-1333",
          "CWE-407"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54284.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-54284",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 492521,
  "published_at": "2026-08-17T17:43:48.243+00:00"
}