CVE-2024-3271 Command Injection in run-llama/llama_index
Attackers can bypass security checks in the safe_eval function to execute arbitrary OS commands, leading to remote code execution on the host.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-3271?
CVE-2024-3271 is a critical command injection vulnerability in run-llama/llama_index, published on 16 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
A command injection vulnerability exists in the run-llama/llama_index repository, specifically within the safe_eval function. Attackers can bypass the intended security mechanism, which checks for the presence of underscores in code generated by LLM, to execute arbitrary code. This is achieved by crafting input that does not contain an underscore but still results in the execution of OS commands. The vulnerability allows for remote code execution (RCE) on the server hosting the application.
Weakness: CWE-77
Which versions are affected by CVE-2024-3271?
3 open source packages ship an affected version, including llama-index-core. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
llama-index-core PyPI | All versions | 0.10.24 |
llama-index-core PyPI | All versions | 0.10.24 |
llama-index-core PyPI | All versions | 0.10.24 |
Products include Llamaindex Llamaindex.
How do I fix CVE-2024-3271?
Upgrade llama-index-core to 0.10.24 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2024-3271 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-3271 exists.
Other vulnerabilities in run-llama/llama_index
Sources
Also known as GHSA-r6gp-rff2-p3hf, PYSEC-2026-396.