Vulnerability  ·  2026-11-19

LiteLLM custom-code guardrail sandbox escape → RCE in the AI proxy, actively exploited in the wild (CVE-2026-40217)

VulnerabilityHigh impactGlobalCVE-2026-40217
BerriAI LiteLLM's POST /guardrails/test_custom_code endpoint runs user-supplied Python inside a hand-rolled sandbox that can be escaped with bytecode-level techniques, giving arbitrary code execution in the proxy process (which runs as root in the default Docker image). It was added to the CISA KEV catalog on 2026-11-18 with confirmed in-the-wild exploitation. The advisory notes the endpoint needs a proxy-admin credential in default configurations, but the observed exploitation chains a low-privilege virtual-key user into this escape to elevate to admin and execute code.
LiteLLM is a widely deployed AI gateway/proxy in front of many LLM applications; it holds model API keys and per-tenant virtual keys. An attacker who can reach the guardrail test endpoint can execute arbitrary code as the proxy process (root in default container), then read all upstream provider credentials, impersonate any tenant, and manipulate model routing — a full compromise of the AI gateway, not just one chatflow.
POST /guardrails/test_custom_code with bytecode-level sandbox escape → arbitrary code execution in the proxy process as root; exploited in the wild to escalate from limited virtual keys to admin/RCE.
LiteLLM proxy before 1.83.11 (custom-code guardrail); fixed in 1.83.11 (RestrictedPython replaces hand-rolled sandbox)
Upgrade to LiteLLM 1.83.11 or later; if not possible immediately, block POST /guardrails/test_custom_code at the reverse proxy/API gateway; treat any virtual-key compromise as host compromise.
CISA KEV catalog — CVE-2026-40217BerriAI/litellm security advisory GHSA-wxxx-gvqv-xp7p (sandbox escape, fixed 1.83.11)NVD detail — CVE-2026-40217
See this in the live feed Explore related AI security and governance findings — updated every morning.
Open the feed →