Skip to content
OpenAdvisories
Medium · 5.1 CVE-2026-84305 EUVD-2026-69421GHSA-cfqr-cjx5-5jcmPYSEC-2026-3923

sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption

Published Sep 1, 2026 · Updated Sep 1, 2026 · Assigned by GitHub_M

Description

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.

Affected products

VendorProductAffectedFixed
andialbrecht sqlparse < 0.6.0 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 sqlparse No fix yet —
Debian 13 sqlparse No fix yet —
Debian 12 sqlparse No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 sqlparse No fix yet —
Ubuntu 26.04 LTS sqlparse No fix yet —
Ubuntu 24.04 LTS sqlparse No fix yet —
Ubuntu 22.04 LTS sqlparse No fix yet —
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS sqlparse No fix yet —
Ubuntu Pro 18.04 LTS sqlparse No fix yet —
Ubuntu Pro 16.04 LTS sqlparse No fix yet —
ReleasePackageFixed inAdvisory
SLES 15 SP7 python-sqlparse 0.2.4-150100.6.14.1 SUSE-SU-2026:3978-1
SLES 15 SP6 python-sqlparse 0.4.4-150600.3.12.1 SUSE-SU-2026:4145-1
SLES 15 SP5 python-sqlparse 0.4.4-150400.6.19.1 SUSE-SU-2026:4109-1
SLES 15 SP4 python-sqlparse 0.4.4-150400.6.19.1 SUSE-SU-2026:4109-1
SLES 3 python-sqlparse 0.4.4-150600.3.12.1 SUSE-SU-2026:4145-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 python-sqlparse 0.5.3-160000.5.1 SUSE-SU-2026:23634-1
SLES 16.0 python-sqlparse 0.5.3-160000.5.1 SUSE-SU-2026:23634-1
ReleasePackageFixed inAdvisory
openSUSE Leap 16.0 python-sqlparse 0.5.3-160000.5.1 openSUSE-SU-2026:21777-1

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI sqlparse < 0.6.0 0.6.0 GHSA-cfqr-cjx5-5jcm

Advisories 5

References