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

CVE-2024-4264: litellm passes untrusted data to `eval` function without sanitization

highCVSS 3.1 7.2GHSA-7ggm-4rjg-594w

LiteLLM 1.28.11 and earlier pass untrusted data to eval in litellm.get_secret() when the proxy uses Google KMS. An administrator-level caller can set environment values through /config/update and run code on the proxy host. The advisory lists no patched version.

Published May 18, 2024 · Updated May 20, 2024 · Analysis Nov 2, 2026

What an attacker can do

When the server is set up with Google KMS, litellm.get_secret() evaluates the value it reads using Python eval, with no sanitization. The proxy's /config/update endpoint lets a caller change settings stored in proxy_server_config.yaml, including environment variables. An attacker can put a crafted value in an environment variable. The next secret lookup evaluates it as Python code.

The CVSS vector (7.2) requires high privileges. The caller needs rights to update the proxy configuration, so this is not an anonymous attack. It matters most where many people hold admin keys, where an admin key leaks, or where /config/update is reachable from untrusted networks. The result is code execution as the proxy user, which holds the upstream provider API keys for every model the gateway serves. An attacker could steal them, read prompts and responses, or move on from that host.

Who is affected

The pip package litellm at version 1.28.11 and earlier. The code path applies only when the proxy server uses Google KMS. Check the installed version:

pip show litellm

Then check whether your proxy config enables Google KMS and who holds a key that can call /config/update.

litellm

Ecosystem
PyPI
Affected
<= 1.28.11
Fixed in
No patched version yet
Check
pip show litellm

How to fix it

The GitHub advisory lists no patched version for the range of 1.28.11 and earlier, and gives no workaround. Move to a current litellm release and confirm that get_secret() no longer calls eval on the secret value in that release. The advisory does not confirm which release changed it.

Until you have checked, restrict who can call /config/update, keep admin keys out of shared use, and do not expose the proxy admin routes to the internet. Do not enable Google KMS on an affected version unless you must.

How to tell if you were hit

Review proxy access logs for calls to /config/update, especially from unexpected callers, and for environment settings with Python-looking content (parentheses, __import__, quotes, semicolons). Compare proxy_server_config.yaml with your version-controlled copy. On the host, check for child processes spawned by the proxy and for outbound connections it does not normally make. Rotate provider keys if you find a suspicious update.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

A remote code execution (RCE) vulnerability exists in the berriai/litellm project due to improper control of the generation of code when using the eval function unsafely in the litellm.get_secret() method. Specifically, when the server utilizes Google KMS, untrusted data is passed to the eval function without any sanitization. Attackers can exploit this vulnerability by injecting malicious values into environment variables through the /config/update endpoint, which allows for the update of settings in proxy_server_config.yaml.

Questions

Does CVE-2024-4264 affect every LiteLLM proxy?

No. The unsafe eval sits in get_secret() and applies when the server uses Google KMS. Versions 1.28.11 and earlier are in range.

Can an unauthenticated user exploit it?

Not by the advisory. The CVSS vector requires high privileges, because the attacker must be able to call /config/update to set the malicious environment values.

Is it exploited in the wild?

The advisory does not say so and the entry is not in CISA's KEV catalog. Its EPSS score is below 1 percent.

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