SECURITYHIGHCVE-2026-40217

CVE-2026-40217: LiteLLM Guardrail Sandbox Escape Added to CISA KEV (CVSS 8.8)

CISA lists exploited CVE-2026-40217: LiteLLM proxy 1.81.8 to 1.83.9 lets attackers with an admin key run code via /guardrails/test_custom_code. Upgrade to 1.83.11.

Dylan H.

Security Team

November 19, 2026
2 min read
CVE-2026-40217: LiteLLM Guardrail Sandbox Escape Added to CISA KEV (CVSS 8.8)

Actively exploited

Reported as exploited in the wild (e.g. CISA KEV). Patch or mitigate immediately.

Affected Products

  • BerriAI LiteLLM proxy 1.81.8 up to and including 1.83.9 (fixed in 1.83.11) with /guardrails/test_custom_code reachable

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

ItemDetail
AffectedLiteLLM proxy 1.81.8 through 1.83.9, endpoint reachable
Fixed1.83.11 or later
NoteSome 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.
  1. Upgrade the LiteLLM proxy to 1.83.11 or later.
  2. If you cannot upgrade now, block POST /guardrails/test_custom_code at your reverse proxy or API gateway.
  3. Do not expose the proxy admin interface to the internet. Restrict it to trusted networks.
  4. Audit and rotate proxy-admin and virtual keys, then rotate upstream provider keys (OpenAI, Anthropic, and others) stored on any exposed proxy.
  5. Review proxy logs for calls to the guardrails test endpoint and for unexpected spend or new keys.

References