CVE-2024-23751 SQL injection in llama-index

Critical 9.8 Published Updated

Attackers can execute arbitrary SQL commands via natural language input in LlamaIndex query engines, potentially modifying or deleting database records.

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

CVE-2024-23751 is a critical SQL injection vulnerability in n/a, published on 22 Jan 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

LlamaIndex (aka llama_index) through 0.9.34 allows SQL injection via the Text-to-SQL feature in NLSQLTableQueryEngine, SQLTableRetrieverQueryEngine, NLSQLRetriever, RetrieverQueryEngine, and PGVectorSQLQueryEngine. For example, an attacker might be able to delete this year's student records via "Drop the Students table" within English language input.

Weakness: CWE-89

Which versions are affected by CVE-2024-23751?

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

PackageAffectedFixed in
llama-index PyPIAll versions to 0.9.35None
llama-index PyPIAll versions to 0.9.35None
llama-index PyPIAll versions0.9.35

Products include Llamaindex Llamaindex.

How do I fix CVE-2024-23751?

Upgrade llama-index to 0.9.35 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-23751 being exploited?

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

Sources

Also known as GHSA-2jxw-4hm4-6w87, PYSEC-2024-12.

Is CVE-2024-23751 in your software?

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

Check your SBOMs for free