Skip to content
OpenAdvisories
High · 8.7 CVE-2026-71491 EUVD-2026-60309GHSA-f2ff-p2ww-7p4pPYSEC-2026-3697

sqlparse: Quadratic O(n²) DoS in group_comments

Published Aug 17, 2026 · Updated Aug 17, 2026 · Assigned by GitHub_M

Description

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, group_comments in sqlparse/engine/grouping.py repeatedly rescans comment-only statements before the MAX_GROUPING_TOKENS guard, causing quadratic CPU consumption through sqlparse.parse() and sqlparse.format(sql, strip_comments=True). 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.04 LTS sqlparse 0.5.4-1ubuntu0.1 USN-8808-1
Ubuntu 24.04 LTS sqlparse 0.4.4-1ubuntu0.2 USN-8808-1
Ubuntu 22.04 LTS sqlparse 0.4.2-1ubuntu0.22.04.3 USN-8808-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS sqlparse 0.2.4-3ubuntu0.1+esm1 USN-8808-1
Ubuntu Pro 18.04 LTS sqlparse 0.2.4-0.1ubuntu0.1+esm1 USN-8808-1
Ubuntu Pro 16.04 LTS sqlparse 0.1.18-1ubuntu0.1~esm1 USN-8808-1
ReleasePackageFixed inAdvisory
Red Hat Satellite Utils 6 foreman +1 3.14.0.22-1.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Utils 6 rubygem-hammer_cli 3.14.0-2.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Utils 6 satellite +1 6.17.12-1.el9sat RHSA-2026:74505, RHSA-2026:74504
Red Hat Satellite Capsule 6 foreman +2 3.14.0.22-1.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Capsule 6 pulpcore-obsolete-packages 1.3.1-6.el9pc RHSA-2026:74504
Red Hat Satellite Capsule 6 python-dynaconf +1 3.2.13-1.el9pc RHSA-2026:74505
Red Hat Satellite Capsule 6 python-gitpython +2 3.1.62-1.el9pc RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Capsule 6 python-lxml +1 5.3.1-2.el9pc RHSA-2026:74505
Red Hat Satellite Capsule 6 python-sqlparse +2 0.6.0-1.el9pc RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Capsule 6 python3.12-dynaconf 3.2.13-2.el9pc RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite Capsule 6 satellite +3 6.17.12-1.el9sat RHSA-2026:74505, RHSA-2026:74504
Red Hat Satellite 6 foreman +14 3.14.0.22-1.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 pulpcore-obsolete-packages 1.3.1-6.el9pc RHSA-2026:74504
Red Hat Satellite 6 python-dynaconf +1 3.2.13-1.el9pc RHSA-2026:74505
Red Hat Satellite 6 python-gitpython +2 3.1.62-1.el9pc RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 python-lxml +1 5.3.1-2.el9pc RHSA-2026:74505
Red Hat Satellite 6 python-sqlparse +2 0.6.0-1.el9pc RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 python3.12-dynaconf 3.2.13-2.el9pc RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 rubygem-foreman_remote_execution +1 15.0.2-2.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 rubygem-hammer_cli 3.14.0-2.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 rubygem-katello 4.16.0.20-1.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Red Hat Satellite 6 rubygem-safemode 1.5.0-2.el9sat RHSA-2026:74505, RHSA-2026:74504
Red Hat Satellite 6 satellite +3 6.17.12-1.el9sat RHSA-2026:74505, RHSA-2026:74504
Red Hat Satellite 6 yggdrasil-worker-forwarder 0.1.0-2.1.el9sat RHSA-2026:74505, RHSA-2026:74504, RHSA-2026:74503
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Red Hat Ansible Automation Platform Inside 2 receptor 1.6.8-1.el8ap RHSA-2026:71114, RHSA-2026:71113, RHSA-2026:71112
Red Hat Ansible Automation Platform Developer 2 automation-controller +1 4.7.17-1.el9ap RHSA-2026:71113
Red Hat Ansible Automation Platform Developer 2 python-sqlparse +1 0.6.0-1.el10ap RHSA-2026:71113, RHSA-2026:71112
Red Hat Ansible Automation Platform Developer 2 python3.12-sqlparse 0.6.0-1.el8ap RHSA-2026:71114, RHSA-2026:71113, RHSA-2026:71112
Red Hat Ansible Automation Platform Developer 2 receptor 1.6.8-1.el8ap RHSA-2026:71114, RHSA-2026:71113
Red Hat Ansible Automation Platform 2 automation-controller +3 4.7.17-1.el9ap RHSA-2026:71113
Red Hat Ansible Automation Platform 2 automation-controller-venv-tower 4.6.33-1.el8ap RHSA-2026:71114, RHSA-2026:71113
Red Hat Ansible Automation Platform 2 automation-gateway-proxy-server 2.5.10-8.el8ap RHSA-2026:71114, RHSA-2026:71113
Red Hat Ansible Automation Platform 2 automation-gateway-server 2.5.20260923-1.el8ap RHSA-2026:71114
Red Hat Ansible Automation Platform 2 automation-platform-ui 2.6.14-1.el9ap RHSA-2026:71113
Red Hat Ansible Automation Platform 2 python-sqlparse +1 0.6.0-1.el10ap RHSA-2026:71113, RHSA-2026:71112
Red Hat Ansible Automation Platform 2 python3.12-gitpython 3.1.60-1.el8ap RHSA-2026:71114, RHSA-2026:71113
Red Hat Ansible Automation Platform 2 python3.12-sqlparse 0.6.0-1.el8ap RHSA-2026:71114, RHSA-2026:71113, RHSA-2026:71112
Red Hat Ansible Automation Platform 2 receptor 1.6.8-1.el8ap RHSA-2026:71114, RHSA-2026:71113, RHSA-2026:71112
ReleasePackageFixed inAdvisory
SLES 15 SP7 python-sqlparse 0.2.4-150100.6.11.1 SUSE-SU-2026:3762-1
SLES 15 SP7 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES 15 SP6 python-sqlparse 0.4.4-150600.3.9.1 SUSE-SU-2026:3907-1
SLES 15 SP6 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES 15 SP5 python-sqlparse 0.4.4-150400.6.16.1 SUSE-SU-2026:3910-1
SLES 15 SP5 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES 15 SP4 python-sqlparse 0.4.4-150400.6.16.1 SUSE-SU-2026:3910-1
SLES 15 SP4 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES 3 python-sqlparse 0.4.4-150600.3.9.1 SUSE-SU-2026:3907-1
Show 7 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 python-sqlparse 0.5.3-160000.4.1 SUSE-SU-2026:23561-1
SLES for SAP 15 SP6 python-sqlparse 0.4.4-150600.3.9.1 SUSE-SU-2026:3907-1
SLES for SAP 15 SP6 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES for SAP 15 SP5 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES for SAP 15 SP4 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLES 16.0 python-sqlparse 0.5.3-160000.4.1 SUSE-SU-2026:23561-1
SLE HPC 15 SP5 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
SLE HPC 15 SP4 python3-sqlparse 0.4.2-150300.23.1 SUSE-SU-2026:3906-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-sqlparse 0.6.0-1.1 openSUSE-SU-2026:11557-1
openSUSE Leap 16.0 python-sqlparse 0.5.3-160000.4.1 openSUSE-SU-2026:21690-1

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling airflow-3 3.3.1-r3 —
Wolfi rolling mycli 2.16.0-r1 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI sqlparse < 0.6.0 0.6.0 GHSA-f2ff-p2ww-7p4p

Advisories 15

References