LLama-Index CLI OS command injection vulnerability
The LLama-Index CLI passed the --files argument directly into os.system without sanitisation, allowing an attacker who controls that argument to inject and execute arbitrary shell commands. This could lead to arbitrary code execution locally or remotely if a web application calls the CLI with a user-controlled filename.
run-llama/llama_index
Originally disclosed on huntr
LLama-Index CLI prior to v0.4.1, corresponding to LLama-Index prior to v0.12.21, contains an OS command injection vulnerability. The vulnerability arises from the improper handling of the --files argument, which is directly passed into os.system. An attacker who controls the content of this argument can inject and execute arbitrary shell commands. This vulnerability can be exploited locally if the attacker has control over the CLI arguments, and remotely if a web application calls the LLama-Index CLI with a user-controlled filename. This issue can lead to arbitrary code execution on the affected system.
From the GitHub Advisory Database (GHSA-g99h-56mw-8263, CC BY 4.0).
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
The --files argument was passed directly into os.system without sanitisation or escaping.
Impact
An attacker could execute arbitrary shell commands, leading to arbitrary code execution on the affected system, locally or remotely if a web application passes a user-controlled filename to the CLI.
What the attacker needed
Control over CLI arguments; or web app passes user filename to CLI
The fix
The vulnerability was fixed in LLama-Index CLI v0.4.1 and LLama-Index v0.12.21 by properly handling the --files argument.
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 a command injection bug. The tool took a filename from the user and put it straight into a system command without cleaning it, so someone could sneak in extra shell commands. That means they could run their own programs on the machine, not just read the file.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.