Skip to content
AI / LLM Disclosed report Advanced CVE-2024-3098

llama-index-core Prompt Injection vulnerability leading to Arbitrary Code Execution

The safe_eval function in llama_index's exec_utils class insufficiently validates input, allowing a prompt injection to bypass method restrictions and execute arbitrary code. An attacker could exploit this to run unauthorised code, as demonstrated by creating a file on the system.

run-llama/llama_index

Originally disclosed on huntr

Critical View original

A vulnerability was identified in the exec_utils class of the llama_index package, specifically within the safe_eval function, allowing for prompt injection leading to arbitrary code execution. This issue arises due to insufficient validation of input, which can be exploited to bypass method restrictions and execute unauthorized code. The vulnerability is a bypass of the previously addressed CVE-2023-39662, demonstrated through a proof of concept that creates a file on the system by exploiting the flaw.

From the GitHub Advisory Database (GHSA-wvpx-g427-q9wc, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the safe_eval function does not properly restrict which methods or operations can be called, allowing a crafted input to escape the intended sandbox.

Impact

An attacker could execute arbitrary code on the system, potentially leading to full compromise, though the text only demonstrates file creation.

What the attacker needed

Ability to influence input to safe_eval

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is about a helper function that is supposed to safely evaluate small pieces of Python code, but it can be tricked into running harmful code instead. An attacker who can influence the input to this function could make the system do things it should not, like create files. The flaw is a bypass of an earlier fix for a similar problem.

What is AI / LLM?

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.

More from run-llama/llama_index

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

AI and LLM vulnerabilities

The lesson behind this report.

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.