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

CVE-2024-6825: LiteLLM Vulnerable to Remote Code Execution (RCE)

highCVSS 3.0 8.8GHSA-53gh-p8jc-7rg8

LiteLLM 1.40.3.dev2 through 1.40.12 lets an authenticated user set a `post_call_rules` callback to a system function such as `os.system`. LiteLLM imports and calls it when a chat response is processed, so the attacker runs arbitrary commands on the proxy host. The advisory data lists no patched version. A later upstream commit blocks dangerous module names.

Published Mar 20, 2025 · Updated Oct 15, 2025 · Analysis Nov 1, 2026

What an attacker can do

The post_call_rules setting names a callback function as a dotted string. LiteLLM splits the string at the final .. The last part is the function name. The rest gets .py appended and is imported as a module. Nothing limits what can be named, so an attacker can point the rule at a standard library function like os.system. When a chat response is processed, LiteLLM calls it, with the response content as the argument.

The attacker needs an account that can set this configuration on the LiteLLM proxy (low privileges in the vector), and no user interaction. The result is command execution as the proxy's user (CWE-77, CWE-94). From there they can read the provider API keys, master key and database credentials the proxy holds, and use the host for further access.

A shared LiteLLM gateway that gives teams limited keys and config access is the main exposure, because the people who can set the rule are not all trusted with the host. A single-user deployment where the config is fully trusted has little extra risk.

Who is affected

Affected: litellm from 1.40.3.dev2 up to and including 1.40.12, per the advisory. The advisory lists no patched version, so later releases are not confirmed as fixed by this entry.

pip show litellm

Check your proxy config and database for post_call_rules entries. Any value pointing at a module such as os, subprocess or sys is a red flag.

litellm

Ecosystem
PyPI
Affected
>= 1.40.3.dev2, <= 1.40.12
Fixed in
No patched version yet
Check
pip show litellm

How to fix it

The advisory data lists no patched version. An upstream commit (441c727, "test fix post call rules") changes get_instance_fn in litellm/proxy/types_utils/utils.py. It adds a security_checks step that raises ImportError for module names containing os, sys, subprocess, socket, pickle, ctypes or builtins before importing them. The commit page shows no release number, so check the LiteLLM release notes and move to a current release that includes it.

Until then:

  • Do not let untrusted users change proxy configuration.
  • Remove any post_call_rules you did not set.
  • Run the proxy as an unprivileged user with no access to unrelated secrets.

How to tell if you were hit

Search your LiteLLM config files and any config stored in the database for post_call_rules values that name standard library modules, for example os.system. Review proxy logs for ImportError or unexpected import activity right after a config change.

On the host, look for child processes spawned by the LiteLLM server, such as sh, curl or bash, that coincide with chat responses. Check outbound network connections from the proxy to unfamiliar hosts.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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.

Questions

Which LiteLLM version fixes CVE-2024-6825?

The advisory lists none. Versions 1.40.3.dev2 to 1.40.12 are affected. A later upstream commit adds a dangerous-module check in get_instance_fn, but its commit page shows no release number.

Does the attacker need to be logged in?

Yes. The vector shows low privileges: the attacker must be able to set the post_call_rules configuration. No user interaction is needed.

What does the attacker get?

Arbitrary command execution on the proxy host, with the proxy user's rights. That includes the API keys and credentials the proxy holds.

Is it exploited in the wild?

No source reports exploitation, and it is not in CISA's KEV catalog.

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 LiteLLM vulnerabilities

All LiteLLM entries