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
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| 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.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | sqlparse | No fix yet | — |
| Debian 13 | sqlparse | No fix yet | — |
| Debian 12 | sqlparse | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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 | — |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 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 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Leap 16.0 | python-sqlparse | 0.5.3-160000.5.1 | openSUSE-SU-2026:21777-1 |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | sqlparse | < 0.6.0 | 0.6.0 | GHSA-cfqr-cjx5-5jcm |
Advisories 5
- SUSE-SU-2026:23634-1 Security update for python-sqlparse SUSE / openSUSE Security Updates · Sep 29, 2026
- SUSE-SU-2026:4145-1 Security update for python-sqlparse SUSE / openSUSE Security Updates · Sep 15, 2026
- SUSE-SU-2026:4109-1 Security update for python-sqlparse SUSE / openSUSE Security Updates · Sep 14, 2026
- SUSE-SU-2026:3978-1 Security update for python-sqlparse SUSE / openSUSE Security Updates · Sep 13, 2026
- openSUSE-SU-2026:21777-1 Security update for python-sqlparse SUSE / openSUSE Security Updates · Sep 9, 2026