LiteLLM CVE-2026-40217 Enters CISA KEV: Your AI Gateway Is a Key Vault

Manish Garg
Manish Garg Associate of (ISC)² · RingSafe
Dec 3, 2026
6 min read
Read as

CISA added LiteLLM CVE-2026-40217 — a sandbox escape in the AI gateway’s custom-code guardrails — to its KEV catalogue on 18 November 2026. Chained with CVE-2026-47101 and CVE-2026-47102, a low-privilege user can become proxy admin and run code as root in the default container, then read every LLM provider key, the master key and the database URL. Upgrade to 1.83.14-stable or later, block /guardrails/test_custom_code, and rotate keys if your proxy was reachable.

AI gateways have become the new key vault. LiteLLM — the open-source proxy that gives applications one OpenAI-compatible API in front of 100+ model providers — centralises exactly the secrets attackers want: OpenAI, Anthropic, Azure and AWS Bedrock keys, budgets and routing rules. On 18 November 2026 CISA added CVE-2026-40217, a sandbox escape in LiteLLM’s custom-code guardrail feature, to its Known Exploited Vulnerabilities catalogue, with a federal deadline of 2 December. Google’s Threat Intelligence Group has linked LiteLLM abuse to “LLMjacking” operations where stolen model access ran up fraud of more than $100,000 in a single day at some victims.

How the sandbox escape works

LiteLLM lets administrators write custom guardrails in Python — small functions that inspect prompts and responses to enforce safety policy. That code is compiled and executed by the proxy. The original protection was a regex deny-list over the source text: names like __globals__ and __builtins__ were rejected. Researchers at Zenity and others showed why text filters never sandbox Python:

  • Blocked names were rebuilt at runtime from string fragments, so the filter never saw them.
  • Code objects were rewritten (code.replace(co_names=...)) to reach the real __import__.
  • Generator and coroutine internals (gi_code, cr_frame) offered another route to builtins.
  • According to Obsidian Security, the production paths (POST /guardrails, PUT /guardrails/{id}) used exec() with builtins reachable and no deny-list at all.

Because the default Docker image runs the proxy as root, escaping the “sandbox” means root code execution inside the container.

The chain: from ordinary user to proxy admin

Since v1.82.0-stable, the guardrail endpoints require the PROXY_ADMIN role, so CVE-2026-40217 on its own needs admin. Obsidian Security found the two missing links:

  • CVE-2026-47101 — allowed_routes was stored unvalidated on key generation and update, so a non-admin could mint a virtual key allowed to call "/*".
  • CVE-2026-47102 — /user/update and /user/bulk_update did not protect the user_role field, so a user could set themselves to proxy_admin.

Together: internal_user → proxy_admin → code execution via a guardrail. Obsidian rates the chain CVSS 9.9. Scores for CVE-2026-40217 alone vary by source (7.5 to 8.8) mainly because of disagreement over the privileges required; do not describe it as unauthenticated.

What attackers actually tried

Zenity ran a LiteLLM honeypot from 15 April to 24 May 2026 and recorded 569 POST requests to /guardrails/test_custom_code:

  • 520 identical capability probes on a single day, returning {'probe':1} to confirm the endpoint executed code.
  • 47 attempts with guessed master keys — sk-1234, sk-admin, sk-changeme — and 64 with empty authentication. Default and example keys left in production remain a real entry point.
  • Payloads that dumped os.environ filtered for key, secret, api, aws, openai, anthropic, master and database; others ran shell commands via subprocess.Popen(..., shell=True).

The prize is concrete. Obsidian lists LITELLM_MASTER_KEY, LITELLM_SALT_KEY (which decrypts provider keys stored in the database) and DATABASE_URL, alongside raw provider keys and cloud credentials. With those, an attacker can resell model access, run their own workloads on your bill, read logged prompts and responses, or pivot into the cloud account.

Google GTIG’s 2 November report described a cluster that obtained “pre-validated” virtual keys and used LiteLLM to elevate them to PROXY_ADMIN; its wording of the CVE differs from later descriptions, but the outcome — gateway takeover — is the same.

Fixed versions, clarified

Affected: >= 1.81.8, < 1.83.10. Version 1.83.10 fixed the sandbox escape, but 1.83.14-stable (25 April 2026) is the first release with the complete fix set for all three CVEs. Also avoid litellm==1.107.0 and image tags from 21 October that the Cloud Security Alliance flags as poisoned in a separate supply-chain incident — pin by version and image digest.

The India angle

Indian startups and GCCs have adopted LLM gateways quickly — often a LiteLLM container deployed by one engineer to give the whole company “one key for all models”, with the admin UI on a public load balancer for convenience. Three things make this urgent here:

  • Prompt logs are personal data. Gateways commonly log prompts and completions for cost tracking and debugging. Customer support transcripts, KYC snippets and internal documents pass through them. Under the DPDP Act, unauthorised access to those logs is a personal data breach.
  • Billing fraud lands in rupees. LLMjacking turns your provider keys into someone else’s compute. At current model prices a stolen key can burn through a startup’s monthly budget in hours.
  • Shadow AI infrastructure. These deployments frequently sit outside the asset inventory and outside VAPT scope. If your security team does not know the gateway exists, it was not tested.

What to do now

  1. Upgrade to LiteLLM 1.83.14-stable or later, pinned by version and image digest.
  2. Block POST /guardrails/test_custom_code at the reverse proxy and alert on any external request to guardrail endpoints.
  3. Take the admin UI and control plane off the internet; expose only the inference routes your applications need.
  4. Run the container as non-root and replace any default or example master key.
  5. Audit proxy_admin users, configured guardrails and config.yaml callbacks (callbacks do not show in the admin UI).
  6. If the proxy was reachable from untrusted networks, rotate the master key, salt key, provider keys, database credentials and all virtual keys — and check provider billing dashboards for spikes.
  7. Question custom-code guardrails: if you do not need them, disable them; if you do, run that logic in a separate, isolated service.

Frequently asked questions

Is LiteLLM CVE-2026-40217 exploitable without logging in?

Not directly. The vulnerable guardrail endpoints require proxy-admin privileges in current versions, but the companion flaws CVE-2026-47101 and CVE-2026-47102 let a low-privilege user reach admin, and default master keys like sk-1234 are actively guessed.

Which LiteLLM version fixes all three vulnerabilities?

Version 1.83.14-stable or later. Version 1.83.10 fixed the sandbox escape but not the full privilege-escalation chain.

What should I rotate after patching?

If the proxy was exposed: the LiteLLM master key and salt key, every LLM provider key configured in the gateway, the database credentials, and all virtual keys issued to users and applications.

For more on securing AI infrastructure, see our analysis of MCP protocol security risks and the Langflow-based LLM agent ransomware campaign. RingSafe’s VAPT engagements now include AI gateways, agent frameworks and model-provider key handling.

Sources

Worried about your exposure?

Get a free attack-surface review

We check what an attacker would see about your business — leaked credentials, exposed services, dark-web mentions. 30 minutes, no obligation.

Book exposure review Replies in 4 working hrs · India-only · Senior consultants