Skip to content
RCE Disclosed report Intermediate CVE-2024-6825

LiteLLM Vulnerable to Remote Code Execution (RCE)

The post_call_rules configuration in LiteLLM allowed a callback function to be set to a system method such as os.system, which would then be executed when a chat response was processed. An attacker could therefore run arbitrary commands on the server.

BerriAI/litellm

Originally disclosed on huntr

BerriAI/litellm version 1.40.12 contains a vulnerability that allows remote code execution. The issue exists in the handling of the 'post_call_rules' configuration, where a callback function can be added. The provided value is split at the final '.' mark, with the last part considered the function name and the remaining part appended with the '.py' extension and imported. This allows an attacker to set a system method, such as 'os.system', as a callback, enabling the execution of arbitrary commands when a chat response is processed.

From the GitHub Advisory Database (GHSA-53gh-p8jc-7rg8, 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

The application split the user-supplied callback string at the last dot and imported the resulting module without validating that the function was an intended, safe callback.

Impact

An attacker could execute arbitrary commands on the server when a chat response is processed, leading to full remote code execution.

What the attacker needed

Control over post_call_rules configuration

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.

LiteLLM is a tool that lets applications talk to different AI chat models. It had a setting that let you name a function to run after each chat reply, but it did not check which function you named, so someone could name a built-in operating system command instead. That meant the server would run whatever command the attacker chose.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from BerriAI/litellm

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.