# CVE-2026-54284: sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger

- Severity: High 8.7 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.33%, higher than 28% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-08-17T17:43:48.243Z
- Modified: 2026-10-23T16:10:00.313Z
- Also known as: GHSA-pwgv-4x5q-6m9f, PYSEC-2026-3699
- Weaknesses: CWE-407, CWE-1333
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

sqlparse is a non-validating SQL parser module for Python. Prior to 0.6.0, TokenList construction and string conversion in sqlparse/sql.py repeatedly flatten nested token subtrees constructed by group_parenthesis and group_case, causing quadratic CPU consumption through sqlparse.parse(), sqlparse.format(), and sqlparse.split() before depth and token limits terminate processing. This issue is fixed in version 0.6.0.

(As written by CVE List.)

## Affected

- andialbrecht sqlparse: < 0.6.0
- sqlparse (PyPI): before 0.6.0

## Every score

- GitHub_M: CVSS:4.0 8.7 High `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`
- GitHub: CVSS:4.0 High `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`
- PyPA Advisory Database: CVSS:4.0 `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`

## References

- <https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-pwgv-4x5q-6m9f> (exploit, web)
- <https://github.com/andialbrecht/sqlparse/commit/939b129e24c0ad5d51368b1aa72fffcaca76f06f> (web)
- <https://github.com/andialbrecht/sqlparse> (package)
- <https://pypi.org/project/sqlparse> (package)
- <https://github.com/advisories/GHSA-pwgv-4x5q-6m9f> (advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-54284> (advisory)

## Sources

- CVE List: [CVE-2026-54284](https://www.cve.org/CVERecord?id=CVE-2026-54284), CVE Terms of Use, modified 2026-08-17
- GitHub Advisory Database: [GHSA-pwgv-4x5q-6m9f](https://github.com/advisories/GHSA-pwgv-4x5q-6m9f), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-54284](https://nvd.nist.gov/vuln/detail/CVE-2026-54284), Public domain, modified 2026-10-23
- PyPA Advisory Database: [PYSEC-2026-3699](https://osv.dev/vulnerability/PYSEC-2026-3699), CC-BY-4.0, modified 2026-08-19

---

Page: https://cve.day/CVE-2026-54284 · Whole record: https://cve.day/CVE-2026-54284.json · Rebuilt by cve.day 2026-11-25T22:59:33.369Z
