---
id: "CVE-2024-3271"
page: "https://infrastack.ai/live/CVE-2024-3271"
kind: "vulnerability"
aliases: ["CVE-2024-3271", "GHSA-r6gp-rff2-p3hf"]
title: "llama-index-core Command Injection vulnerability"
severity: "critical"
cvss: 9.8
epss: 0.02886
exploited: false
status: "open"
category: "package"
products: [{"name": "llama-index-core", "fixed": ["0.10.24"], "affected": "< 0.10.24", "ecosystem": "pypi"}, {"name": "llamaindex", "fixed": ["0.10.26"], "affected": ">= 0.10.6, < 0.10.26", "ecosystem": "vendor"}]
ecosystems: ["pypi", "vendor"]
tags: ["ai-apps", "cwe-77", "llama-index", "package", "python", "rag"]
not_affected_if: ["fixed-version", "no-safe-eval-path"]
published_at: "2024-04-16T00:15:12+00:00"
first_seen_at: "2026-11-16T15:22:27+00:00"
updated_at: "2026-11-16T15:37:59+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-r6gp-rff2-p3hf", "first_seen_at": "2026-11-16T15:22:27+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-3271", "first_seen_at": "2026-11-16T15:37:59+00:00"}]
exploit_sources: [{"type": "poc", "url": "https://huntr.com/bounties/9b32490e-7cf9-470e-8d49-ba083ae7a279"}, {"type": "epss", "score": 0.02886, "url": "https://api.first.org/data/v1/epss?cve=CVE-2024-3271"}]
---

# llama-index-core Command Injection vulnerability

Link for people: https://infrastack.ai/live/CVE-2024-3271 (this .md is for agents)

llama-index-core's safe_eval function checks LLM-generated code for underscores as its safety filter, and that check can be bypassed. An attacker who can influence the model's output or input can get arbitrary operating system commands run on the server hosting the application.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:llama-index-core affected < 0.10.24 fixed 0.10.24
- vendor:llamaindex affected >= 0.10.6, < 0.10.26 fixed 0.10.26

## How to check

- Check the installed version with `pip show llama-index-core`, and look for it in `requirements.txt` or `poetry.lock`.
- Search the codebase for calls to `safe_eval` or code paths that pass LLM output into it.

## Fix

- `llama-index-core` `0.10.24` (fixed version per the advisory data; earlier versions are affected).

## Timeline

- 2026-11-16T15:22:27+00:00 ghsa https://github.com/advisories/GHSA-r6gp-rff2-p3hf
- 2026-11-16T15:37:59+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2024-3271

## Documents

- [fix] Patch: github.com https://github.com/run-llama/llama_index/commit/5fbcb5a8b9f20f81b791c7fc8849e352613ab475
- [fix] Patch: github.com https://github.com/run-llama/llama_index/commit/2c92e88838a5f481d50840240b1dd3180066c6f5
- [poc] Exploit: huntr.com https://huntr.com/bounties/9b32490e-7cf9-470e-8d49-ba083ae7a279

## From the sources

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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
