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

High 7.5 Published Updated

Attackers can cause a Denial of Service in applications using sqlparse by submitting heavily nested SQL lists, triggering a RecursionError.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-4340?

CVE-2024-4340 is a high-severity denial of service vulnerability in sqlparse, published on 30 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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

Weakness: CWE-674

Which versions are affected by CVE-2024-4340?

3 open source packages ship an affected version, including sqlparse.

PackageAffectedFixed in
sqlparse PyPIAll versions0.5.0
sqlparse PyPIAll versions0.5.0
sqlparse PyPIAll versions0.5.0
Linux distribution packages (20)
python-sqlparse Red Hat:openstack:17.1::el8All versions0:0.4.1-2.el8ost
python3-sqlparse Red Hat:openstack:17.1::el8All versions0:0.4.1-2.el8ost
python-sqlparse Red Hat:openstack:17.1::el9All versions0:0.4.1-2.el9ost
python3-sqlparse Red Hat:openstack:17.1::el9All versions0:0.4.1-2.el9ost
python3-sqlparse SUSE:Enterprise Storage 7.1All versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOSAll versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSSAll versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise Module for Basesystem 15 SP5All versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise Module for Basesystem 15 SP6All versions0.4.2-150300.12.1
python-sqlparse SUSE:Linux Enterprise Module for Public Cloud 15 SP4All versions0.4.4-150400.6.7.1
python-sqlparse SUSE:Linux Enterprise Module for Public Cloud 15 SP5All versions0.4.4-150400.6.7.1
python3-sqlparse SUSE:Linux Enterprise Server 15 SP3-LTSSAll versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise Server 15 SP4-LTSSAll versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise Server for SAP Applications 15 SP3All versions0.4.2-150300.12.1
python3-sqlparse SUSE:Linux Enterprise Server for SAP Applications 15 SP4All versions0.4.2-150300.12.1
python3-sqlparse SUSE:Manager Proxy 4.3All versions0.4.2-150300.12.1
python3-sqlparse SUSE:Manager Server 4.3All versions0.4.2-150300.12.1
python-sqlparse openSUSE:Leap 15.5All versions0.4.4-150400.6.7.1
python3-sqlparse openSUSE:Leap 15.5All versions0.4.2-150300.12.1

How do I fix CVE-2024-4340?

Upgrade sqlparse to 0.5.0 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2024-4340 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-4340 exists.

Sources

Also known as DEBIAN-CVE-2024-4340, ECHO-d041-0b74-8b13, GHSA-2m57-hf25-phgg, MGASA-2024-0185, OESA-2024-1533, OESA-2024-1603 and 9 more.

Is CVE-2024-4340 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free