LiteLLM sandbox escape tried with default master keys to run code as root
- Affected
- LiteLLM
1.81.8up to the fixed release, by LiteLLM’s advisory. All versions and fixes
- Vendor
- LiteLLM
lets anyone holding a LiteLLM proxy’s master key escape the sandbox that runs custom guardrail code and run commands on the server, as root in the default Docker image. CISA added it to KEV on Nov 18. Zenity’s honeypots recorded attempts from Apr 15, the day the fix shipped, that paired exploit code with guessed default master keys. Versions from 1.81.8 up to the fix are affected.
LiteLLM is an open-source proxy that gives applications one OpenAI-compatible API for many model providers and holds their keys. Its /guardrails/test_custom_code endpoint runs Python that an administrator submits to test a custom guardrail, the code that filters requests and responses. The sandbox around that code blocked dangerous names with a text deny-list. X41 D-Sec showed that code which rebuilds those names at runtime and rewrites Python bytecode gets past it to the real import function. LiteLLM replaced the sandbox with RestrictedPython.
Reaching the endpoint takes a proxy-admin credential in default configurations, LiteLLM says, so proxies whose master key can be guessed are most at risk. Zenity notes that sk-1234 is the example key in LiteLLM’s documentation and its .env.example file. The official Docker image runs the proxy as root, though LiteLLM also ships a non-root image, Zenity says.
Zenity’s sensors logged 569 POST requests to the endpoint between Apr 15 and May 24, each guessing one of 47 default-style keys or sending none. The first 520, all on Apr 15, sent a harmless probe that shows whether a key works and the endpoint runs code. In May, requests from other addresses carried sandbox escapes that read the proxy’s environment variables, where LiteLLM keeps provider and master keys, or ran commands in the background.
X41 published its advisory and a working exploit on Apr 8, when a mailing-list embargo ran out, and LiteLLM’s advisory followed on May 11. CISA hasn’t said who exploited the flaw or how it learned of the attacks. LiteLLM’s advisory gives 1.83.10 as the fixed version in its version data but tells users to install 1.83.11 or later in its text.
- Vendor
- LiteLLM
What to do
6 steps
Affected and fixed versions
| Product | Affected | Fixed |
|---|---|---|
| LiteLLM proxy (litellm on PyPI) | 1.81.8 through 1.83.9 | 1.83.10, or 1.83.11 or later as the advisory’s text says |
- Product
- LiteLLM proxy (litellm on PyPI)
- Affected
1.81.8through1.83.9- Fixed
1.83.10, or1.83.11or later as the advisory’s text says
Timeline
- Feb 13X41 D-Sec finds the sandbox escape.
- Apr 8X41 publishes its advisory and exploit after the embargo runs out.
- Apr 15LiteLLM ships the fix, and Zenity’s sensors log the first probes.
- May 11LiteLLM publishes its advisory.
- Nov 18CISA adds the flaw to KEV.
Sources
- Zenity researchPrimary source labs.zenity.io
- LiteLLM advisoryPrimary source github.com
- X41 D-Sec researchPrimary source x41-dsec.de