CVE-2024-4340: sqlparse · Uncontrolled Recursion
Affects sqlparseSource CVE Database V5
Not known to be exploited · CVSS 7.5 High.
Data as of 26 Oct 2026, 11:42 UTC
- EPSS
- 3.2% chance of exploitation in 30 days – higher than 88% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HExploitation evidence
Disclosed: evidence found.
CVE published 30 Apr 2024
Detectable: no evidence on record.
No public nuclei template indexed
Weaponised: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.
What to do
Affected software
| Product | Affected | Fixed in |
|---|---|---|
PyPIsqlparsepkg:pypi/sqlparseOther threats | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Until an official patch is released, European organizations should implement strict input validation to detect and reject excessively nested or malformed SQL inputs before they reach sqlparse.parse(). Applying recursion depth limits at the application level can prevent uncontrolled recursion. Monitoring application logs for RecursionError exceptions can help detect attempted exploitation. Employing Web Application Firewalls (WAFs) to filter suspicious payloads targeting SQL parsing endpoints is recommended. Developers should review and update dependencies regularly and subscribe to sqlparse security advisories for timely patch releases. In environments where sqlparse is critical, consider isolating parsing operations in sandboxed processes to contain potential crashes. Additionally, organizations can contribute to or monitor open-source sqlparse repositories for community patches or mitigations. Finally, conducting penetration testing focused on input fuzzing can help identify vulnerable endpoints.
Description
Passing a heavily nested list to sqlparse.parse() leads to a Denial of Service due to RecursionError.
References
- research.jfrog.com/vulnerabilities/sqlparse-stack-exhaustion-dos-jfsa-2024-001031292/ (opens in a new tab)
- github.com/andialbrecht/sqlparse/commit/b4a39d9850969b4e1d6940d32094ee0b42a2cf03 (opens in a new tab)
- github.com/advisories/GHSA-2m57-hf25-phgg (opens in a new tab)
- lists.debian.org/debian-lts-announce/2024/12/msg00022.html (opens in a new tab)