NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LlamaIndex

CVE-2024-3098: llama-index-core Prompt Injection vulnerability leading to Arbitrary Code Execution

criticalCVSS 3.0 9.8GHSA-wvpx-g427-q9wc

llama-index-core before 0.10.24 has a sandbox bypass in safe_eval, in the exec_utils module. Prompt-controlled text can reach it and run arbitrary Python on the host. It bypasses the earlier fix for CVE-2023-39662. Upgrade to llama-index-core 0.10.24.

Published Apr 10, 2024 · Updated Oct 27, 2026 · Analysis Nov 2, 2026

What an attacker can do

safe_eval is meant to evaluate model-generated expressions under restrictions on private and dunder access. Input validation was too weak, so an attacker could get around the method restrictions. The reporter's proof of concept creates a file on the system, which shows code execution in the host process.

The attacker needs to influence text that ends up in safe_eval. In a LlamaIndex app, that is a prompt, or a document or web page the model reads, in a pipeline where the model's output is evaluated. The app does not need to be exposed beyond what already takes untrusted input. The CVSS vector is network, no privileges, no interaction. Successful exploitation runs code as the app's user. That gives access to API keys, indexed data and anything the process can reach.

This is the second break of the same sandbox, after CVE-2023-39662.

Who is affected

llama-index-core versions below 0.10.24. Apps are exposed when untrusted prompts or retrieved content can steer an LLM-generated expression into safe_eval. Check the installed version:

pip show llama-index-core

The legacy llama-index meta package pulls in llama-index-core, so check that as well.

llama-index-core

Ecosystem
PyPI
Affected
< 0.10.24
Fixed in
0.10.24
Check
pip show llama-index-core

How to fix it

Upgrade to llama-index-core 0.10.24:

pip install --upgrade "llama-index-core>=0.10.24"

The fix commit tightens the sandbox in exec_utils.py. It removes getattr, hasattr, iter, next and setattr from the allowed builtins. The DunderVisitor now also flags any name or attribute that is not in ALLOWED_BUILTINS, in addition to names starting with an underscore. The error now reads that access to private or dunder methods, or disallowed builtins, is forbidden. The sources give no workaround.

How to tell if you were hit

Review where your code calls safe_eval or query engines that evaluate model output, and look for the new error text about private or dunder methods or disallowed builtins, which signals blocked attempts on patched versions. On older versions, look for unexpected files created by the Python process, and child processes or outbound connections that start right after an LLM query. Check which llama-index-core version each environment resolves.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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.

Questions

Is llama-index-core 0.10.24 safe from CVE-2024-3098?

Yes. 0.10.24 is the patched version in the advisory. Anything below it is vulnerable.

How does this relate to CVE-2023-39662?

It is a bypass of the earlier fix for CVE-2023-39662. The first fix did not validate input enough, so the method restrictions in safe_eval could be evaded again.

Do I need to be logged in or have local access?

No. The CVSS vector is network, no privileges, no user interaction. What matters is whether untrusted text can reach safe_eval through an LLM.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LlamaIndex vulnerabilities

All LlamaIndex entries