Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2024-4340: CWE-674 Uncontrolled Recursion

0
High
VulnerabilityCVE-2024-4340cvecve-2024-4340cwe-674
Published: Tue Apr 30 2024 (04/30/2024, 14:23:03 UTC)
Source: CVE Database V5

Description

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

AI-Powered Analysis

AILast updated: 11/03/2025, 23:02:45 UTC

Technical Analysis

CVE-2024-4340 is a vulnerability classified under CWE-674 (Uncontrolled Recursion) found in the sqlparse Python library, a popular tool used for parsing SQL statements. The issue arises when the sqlparse.parse() function is called with a heavily nested list structure as input. Due to lack of proper recursion control, the function enters uncontrolled recursive calls, eventually triggering a RecursionError in Python. This error leads to a Denial of Service (DoS) condition by crashing or halting the application that relies on sqlparse for SQL parsing tasks. The vulnerability has a CVSS v3.1 base score of 7.5, indicating high severity. The attack vector is network-based (AV:N), requiring no privileges (PR:N) or user interaction (UI:N), and affects system availability (A:H) without impacting confidentiality or integrity. The vulnerability is exploitable remotely by sending crafted inputs to applications that use sqlparse.parse(), making it a critical concern for services exposed to untrusted input. Currently, no patches or fixes have been officially published, and no known exploits have been observed in the wild. The root cause is insufficient recursion depth checks within the parsing logic, which can be mitigated by implementing recursion limits or input sanitization.

Potential Impact

For European organizations, the primary impact is a Denial of Service affecting applications that utilize the sqlparse library for SQL parsing. This can disrupt services, cause downtime, and potentially lead to cascading failures in systems dependent on database query processing. Industries such as finance, telecommunications, and software development, which often rely on Python-based tools and frameworks, may experience operational interruptions. The vulnerability does not compromise data confidentiality or integrity but can degrade availability, impacting business continuity and service reliability. Organizations exposing APIs or services that parse SQL queries from external sources are particularly at risk. The absence of authentication or user interaction requirements lowers the barrier for exploitation, increasing the threat landscape. While no exploits are currently known, the high CVSS score and ease of triggering the vulnerability necessitate proactive measures to prevent potential attacks.

Mitigation Recommendations

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.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.2
Assigner Short Name
JFROG
Date Reserved
2024-04-30T11:12:30.839Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 690929a9fe7723195e0fd624

Added to database: 11/3/2025, 10:16:09 PM

Last enriched: 11/3/2025, 11:02:45 PM

Last updated: 11/5/2025, 1:31:38 PM

Views: 4

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats