system: OPERATIONAL
← back to all hacks
INFRASTRUCTURE CRITICAL NEW

LiteLLM guardrail sandbox escape is now exploited: what to check

CISA added LiteLLM's custom-code guardrail sandbox escape to its exploited-vulnerabilities list on November 18, 2026, seven months after the fix. Here is how it works and how to check your proxy.

2026-11-21 // 6 min affects: litellm, ai-gateways, llm-proxies

What is this?

On November 18, 2026, CISA added a sandbox escape in the LiteLLM proxy to its Known Exploited Vulnerabilities (KEV) catalog, with a federal remediation deadline of December 2, 2026. The Hacker News reported the listing on November 19, and Ostorlab and the Cloud Security Alliance published analyses on November 19 and 20.

The flaw itself is not new. X41 D-Sec disclosed it on April 8, 2026, and LiteLLM shipped a fix in 1.83.10 on April 27. What changed is the evidence: according to The Hacker News, citing Google Threat Intelligence Group, attackers used it in LLMjacking campaigns to turn limited inference keys into full admin access and keep a foothold on AI gateways. A seven-month-old patch that many teams never applied is now an active entry point. We covered the wider LiteLLM privilege chain in June; this listing confirms that its last link is used in the wild.

How it works

LiteLLM lets administrators write custom-code guardrails: small Python functions that inspect prompts and responses. A test endpoint, POST /guardrails/test_custom_code, runs such code so admins can try it before saving it.

According to the X41 advisory, the “sandbox” around that code was a regex filter on the source text. It rejected code that literally contained dangerous names such as __builtins__, __globals__ or __import__. That approach has a basic weakness: Python code can build those names at runtime instead of writing them out, and it can rewrite compiled code objects after they pass the filter. X41’s proof of concept used both techniques to reach the real import machinery and run operating system commands. The code then ran inside the proxy process, which is root in the default Docker image.

Two points matter for risk assessment:

  • Authentication is required. Ostorlab notes that calling the endpoint needs an admin-level key. “Remote” in the KEV wording describes the network path, not unauthenticated access.
  • Admin access is reachable. The CSA note links the flaw to two LiteLLM privilege bugs disclosed by Obsidian Security, which let a default internal user mint broad keys and promote itself to proxy_admin. Google’s reporting describes attackers starting from stolen or purchased virtual keys. Low-privilege key, then admin, then code on the gateway.

The fix replaced the regex filter with RestrictedPython. The CSA note adds that Obsidian found a variant in the production guardrail creation paths (POST /guardrails, PUT /guardrails/{id}), and that 1.83.14-stable is the first release with the complete fix set.

Example prompt

Illustrative and redacted: this shows the shape of the weakness, not a usable payload.

# LiteLLM custom-code guardrail triage (illustrative, defensive, redacted)
# Pattern: guardrail code that passes a name blocklist, then rebuilds names.
#   endpoint -> POST /guardrails/test_custom_code      (admin key required)
#   code     -> def check(text): [name built at runtime] [REDACTED]
#   effect   -> runs inside the proxy process (root by default)   [payload]
# Defense: upgrade to 1.83.14-stable+, block the test endpoint at the edge,
# audit stored guardrails, callbacks and proxy_admin users, rotate keys.

Why it matters

An AI gateway concentrates secrets: provider API keys for every model, the master key, database credentials and often cloud IAM roles. Code execution there means stolen keys, inference billed to the victim (the core of LLMjacking), and silent changes to routing or callbacks that can read every prompt.

The broader lesson concerns guardrails. A feature meant to make LLM traffic safer became an execution channel because it ran user-supplied code with a text filter as the only barrier. Blocklists on source code have been bypassed for as long as Python sandboxes have existed. Any “custom logic” hook in an AI security product should be treated as code execution and isolated accordingly.

Defenses

  1. Inventory every LiteLLM instance, including staging and developer machines, and check the version inside each running container, not the manifest.
  2. Upgrade to 1.83.14-stable or later. Avoid litellm==1.107.0 and the Docker tags that served it in October (our coverage). Pin by version and image digest, not latest.
  3. If you cannot upgrade now, deny POST /guardrails/test_custom_code at the reverse proxy and restrict guardrail creation endpoints to an admin network.
  4. Hunt for prior compromise. Search logs for calls to the guardrail endpoints and to user update endpoints. In the database, look for unexpected proxy_admin users, unknown custom-code guardrails, new callbacks or changed model api_base values. Check provider billing for spikes.
  5. Upgrading is not cleanup. Malicious guardrails and callbacks are stored in the database and survive an upgrade. If you find signs of compromise, rotate the master key, all provider keys, virtual keys, database and cloud credentials, after preserving evidence.
  6. Harden the gateway. Run the container as non-root, keep the master key in a secrets manager and out of daily use, scope virtual keys to the minimum routes, and send control-plane changes to your SIEM. Run custom-code guardrails in a separate isolated service, or disable them.

Status

ItemDetail
ReferenceCVE-2026-40217 (CWE-94)
SeverityCVSS v4.0 8.7 (X41) / 7.5 (GitHub advisory); CVSS v3.1 8.8
AffectedLiteLLM proxy 1.81.8 up to 1.83.10 (custom-code guardrails)
Fixed1.83.10 (April 27, 2026); full fix set in 1.83.14-stable
DisclosedApril 8, 2026 (X41 D-Sec)
CISA KEVAdded November 18, 2026; due December 2, 2026
ExploitationConfirmed by CISA; LLMjacking activity reported by Google Threat Intelligence Group

Sources