Summary
CVE-2026-40217 is an unprotected alternate channel flaw (CWE-420) in the BerriAI LiteLLM proxy. Remote attackers can execute arbitrary code through bytecode rewriting at the /guardrails/test_custom_code endpoint. It scores CVSS 8.8. CISA added it to the Known Exploited Vulnerabilities (KEV) catalog on November 18, 2026, with a federal remediation deadline of December 2, 2026.
LiteLLM proxies commonly store upstream AI provider keys, so a compromised proxy can expose credentials and enable LLM abuse.
How it works
In affected versions, the guardrail "custom code" test feature ran submitted code in a hand-built sandbox that only scanned the source text for banned names. Attackers can bypass that check by rewriting bytecode and escape to run arbitrary code on the proxy host. BerriAI replaced the sandbox with RestrictedPython in PR #25818, merged April 15, 2026.
Exploitation needs a proxy-admin API key, or a way to obtain one. Public exploit code has been available since April 8, 2026. Using litellm only as a Python SDK, without the proxy server, is not affected.
Affected and fixed versions
| Item | Detail |
|---|---|
| Affected | LiteLLM proxy 1.81.8 through 1.83.9, endpoint reachable |
| Fixed | 1.83.11 or later |
| Note | Some advisory metadata lists 1.83.10 as the fix, while the advisory text says 1.83.11. Use 1.83.11 or later. |
Exploitation status
- Listed in CISA KEV on 2026-11-18.
- Public exploit code available since April 2026.
- CISA's entry does not name victims. Related reporting on AI agents hunting LiteLLM for provider API keys describes the wider targeting of LLM gateways.
Recommended actions
- Upgrade the LiteLLM proxy to 1.83.11 or later.
- If you cannot upgrade now, block
POST /guardrails/test_custom_codeat your reverse proxy or API gateway. - Do not expose the proxy admin interface to the internet. Restrict it to trusted networks.
- Audit and rotate proxy-admin and virtual keys, then rotate upstream provider keys (OpenAI, Anthropic, and others) stored on any exposed proxy.
- Review proxy logs for calls to the guardrails test endpoint and for unexpected spend or new keys.
