sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption
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
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2026-84305
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 2 Nov 2026, 19:29 UTC · Revision 1
Source evidence
sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption
core-osv · Original sourcePublished 1 Sept 2026, 18:33 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:CVE-2026-84305
Complete source record
{
"id": "4a2be3f40154d28c92280ebf5dc9085839304b281b4d7ff78516fcd71e78291e",
"url": "https://osv.dev/vulnerability/CVE-2026-84305",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption",
"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:CVE-2026-84305",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2026-84305",
"aliases": [
"CVE-2026-84305",
"GHSA-cfqr-cjx5-5jcm",
"PYSEC-2026-3923"
],
"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"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/andialbrecht/sqlparse",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "2f40da99b50d81135aecf96f6b08fcfa338a96de"
},
{
"fixed": "a51df6d9e2d31b44be9adb6bc8732517db6bf96b"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.6.0"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "a51df6d9e2d31b44be9adb6bc8732517db6bf96b"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "2f40da99b50d81135aecf96f6b08fcfa338a96de"
}
],
"source": "REFERENCES_TAG",
"original_tag": "0.6.0"
}
]
}
}
],
"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-84305.json"
}
}
],
"modified": "2026-10-28T02:30:22.672542761Z",
"provider": "osv",
"references": [
"https://github.com/andialbrecht/sqlparse/releases/tag/0.6.0",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/84xxx/CVE-2026-84305.json",
"https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-cfqr-cjx5-5jcm",
"https://nvd.nist.gov/vuln/detail/CVE-2026-84305",
"https://github.com/andialbrecht/sqlparse/commit/a51df6d9e2d31b44be9adb6bc8732517db6bf96b"
],
"provider_metadata": {
"cwe_ids": [
"CWE-407"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/84xxx/CVE-2026-84305.json"
}
},
"related_cves": [
{
"value": "CVE-2026-84305",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 489168,
"published_at": "2026-09-01T18:33:10.969+00:00"
}