CVE-2024-11958 SQL Injection in run-llama/llama_index

Critical 9.8 Published Updated

Attackers can execute arbitrary SQL and potentially remote code via the duckdb_retriever component in the llama_index library.

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-11958?

CVE-2024-11958 is a critical SQL injection vulnerability in run-llama/llama_index, published on 20 Mar 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

A SQL injection vulnerability exists in the `duckdb_retriever` component of the run-llama/llama_index repository, specifically in the latest version. The vulnerability arises from the construction of SQL queries without using prepared statements, allowing an attacker to inject arbitrary SQL code. This can lead to remote code execution (RCE) by installing the shellfs extension and executing malicious commands.

Weakness: CWE-89

Which versions are affected by CVE-2024-11958?

3 open source packages ship an affected version, including llama-index-retrievers-duckdb-retriever. It affects 1 product.

PackageAffectedFixed in
llama-index-retrievers-duckdb-retriever PyPIAll versions0.4.0
llama-index-retrievers-duckdb-retriever PyPIAll versions0.4.0
llama-index-retrievers-duckdb-retriever PyPIAll versions0.4.0

Products include Llamaindex Llamaindex.

How do I fix CVE-2024-11958?

Upgrade llama-index-retrievers-duckdb-retriever to 0.4.0 or later.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2024-11958 being exploited?

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

Sources

Also known as GHSA-339r-cjv9-x78g, PYSEC-2026-399.

Is CVE-2024-11958 in your software?

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

Check your SBOMs for free