Your LiteLLM Proxy May Need More Than a Patch for CVE-2026-40217

CISA lists LiteLLM's custom-code guardrail sandbox escape as exploited, with a December 2 federal deadline. Upgrade to 1.83.14-stable, then audit proxy_admin, guardrails and callbacks.

By Rajesh Beri·November 20, 2026·9 min read
Share:
A laptop on a steel crash cart in a dim data-centre aisle, plugged into an open server rack where one unit shows a single amber fault light.

Illustration generated using AI

If you run a self-hosted LiteLLM proxy on any release older than 1.83.14-stable, treat it as compromised until you have checked it. CISA now lists CVE-2026-40217, a code execution flaw in the gateway that holds every one of your model provider keys, as exploited in the wild. The fix has existed since April. What changed on November 18 is that attackers are using it, and patching alone does not undo an attacker who already gave themselves an admin account.

CISA added CVE-2026-40217 to its Known Exploited Vulnerabilities catalog on 2026-11-18, with a due date of 2026-12-02 for federal agencies. That deadline legally binds only the federal government. For everyone else it is the most useful date you will get, because the people exploiting the flaw are not waiting for your change window.

What CISA Added on November 18

CVE-2026-40217 lets someone run arbitrary code on the LiteLLM server through the custom-code guardrail feature. CISA's entry describes it as a vulnerability that "could allow remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI," and classes it under CWE-420. The same entry marks ransomware use as "Unknown."

A custom-code guardrail is a LiteLLM feature that lets an administrator write Python-like filtering logic that runs on every request. LiteLLM's own documentation says the code "runs in a sandboxed environment" with no imports, no file access and no exec() or eval(). The page carries no security warning and does not mention the CVE.

That sandbox is what broke. The project's GitHub advisory, GHSA-wxxx-gvqv-xp7p, says the POST /guardrails/test_custom_code endpoint "runs user-supplied Python inside a hand-rolled sandbox," which the fix replaced with RestrictedPython. Affected versions are >= 1.81.8, < 1.83.10. The advisory also notes the process "runs as root in the default Docker image," so escaping the sandbox lands an attacker as root inside the container that holds your OpenAI, Anthropic, Bedrock and Vertex credentials.

The researchers who found it, X41 D-Sec, identified the issue on 2026-02-13 and published on 2026-04-08, at which point no vendor patch was available.

Who Can Reach the Vulnerable Endpoint?

On its own, the endpoint needs an administrator credential, but two companion bugs let an ordinary user become that administrator. The GitHub advisory states that "reaching the endpoint requires a proxy-admin credential in default configurations," which is why the project scores it as Moderate.

The trouble is how people reach proxy_admin. Obsidian Security documented a chain of three CVEs: CVE-2026-47101, an allowed_routes bypass, and CVE-2026-47102, a user_role self-escalation, take a default internal_user up to proxy_admin. CVE-2026-40217 then turns that role into code execution. Obsidian rates the chain at CVSS 9.9. It also found that the production guardrail paths, POST /guardrails and PUT /guardrails/{id}, used exec() with __builtins__ reachable, so blocking only the test endpoint does not cover every route on a vulnerable build.

LiteLLM's role documentation describes proxy_admin as "Admin over the entire platform" and says the role should go to "Only the people running the LiteLLM instance." An internal_user is the ordinary account that can create and view its own keys. In a typical deployment that can be every developer given gateway access, so the people who can start this chain may include most of your engineering org, plus anyone holding one of their keys.

Why Sources Disagree on the Fix and the Score

The sources do not agree on the patched version, the severity or even the mechanism, and you should plan around the most conservative reading. Here is where they split:

  • Fixed version. The GitHub advisory's metadata says 1.83.10; its text says "Fixed in 1.83.11." Obsidian says v1.83.14-stable "is the first release that contains the complete fix set for all three CVEs". Use 1.83.14-stable or later as your floor.
  • Severity. The GitHub advisory scores CVE-2026-40217 at 5.9 under CVSS v4.0, assuming a high-privilege attacker. X41 scores it 8.7, assuming a low-privilege authenticated one. The difference is exactly the proxy_admin question above, and the chain makes the low-privilege assumption the realistic one.
  • Mechanism. Google Threat Intelligence Group and Mandiant's November 2 report describes an actor who "exploited a user ID rebind vulnerability in the /key/regenerate endpoint (CVE-2026-40217) to elevate standard Virtual Keys into full PROXY_ADMIN master administrative credentials." That is a privilege escalation, which matches the chain's first steps more than the sandbox escape CISA describes.

The Cloud Security Alliance research note published today flags the same conflict and says GTIG's descriptions differ from the vendor advisory. Nobody has publicly reconciled them as of November 20. It does not change what you do, because 1.83.14-stable fixes both the escalation path and the sandbox escape, and the cleanup steps cover either reading.


What Attackers Do With a Gateway They Control

The exploitation behind this listing is LLMjacking: stealing access to paid models and reselling it. GTIG and Mandiant report that across incidents they handled, fraudulent charges exceeded $100,000 USD in a single day, with "cumulative charges at some organizations reaching $1 million USD before access was revoked."

The resale side is organised. The same report describes a routing service called Jet Night that "offers an unlimited token plan for approximately $60 USD per month with alleged access to frontier models," fed by credentials taken from victims. In the LiteLLM case, the actor started with "pre-validated Virtual Keys" bought from whoever had the initial access, then escalated to admin. The report also says the actor "hosted LiteLLM gateways on external servers to manage and route API traffic," so the resellers run the same software as their victims.

A gateway is the best target in that economy because it concentrates everything. One proxy_admin session can mint keys for anyone, read the configured provider credentials and change which callbacks run on each request. The Hacker News summarised Google's observed tactics to include exploiting "LLM routing software, such as CVE-2026-40217 in LiteLLM, to escalate privileges." We covered the same pattern in Google's Q4 AI Threat Tracker and in the Bedrock key thefts tied to nine AI platforms.

The Fix Shipped in April, and LiteLLM Keeps Landing on the List

Any proxy still exposed to CVE-2026-40217 today has missed a patch that is about seven months old. Obsidian dates v1.83.10-stable to April 22 and v1.83.14-stable to April 25, 2026.

This is also not LiteLLM's first appearance in the catalog. The CSA note counts four LiteLLM KEV entries in 2026: CVE-2026-42208 (added May 8), CVE-2026-42271 (June 8), CVE-2026-59822 (September 2) and now CVE-2026-40217. CSA's June research note covered CVE-2026-42271, a command injection in the MCP test endpoints, and also recorded a March 24 PyPI compromise of versions 1.82.7 and 1.82.8. Then came the October 21 backdoored 1.107.0 release on PyPI and Docker, which the CSA note says to avoid by name.

Two conclusions follow. First, an upgrade path for LiteLLM has to be pinned to a specific version and image digest, because "latest" has twice been the attack. Second, a component added to CISA's list four times since May belongs in the same patch tier as your VPN concentrator, which is the posture CISA took when it gave Ray operators three days to patch a KEV entry in August. Google's own recommendation is the same: "Extend vulnerability management programs to include centralized model proxy and routing gateways (e.g., LiteLLM)."

The strongest case against urgency is that the advisory requires admin credentials and most companies keep proxy_admin to a handful of people. That holds only if you are on a build where CVE-2026-47101 and CVE-2026-47102 are fixed and you have actually checked who holds the role. Check both before you rely on that argument.


What to Do Before December 2

Treat the federal due date as your own, and run the cleanup even if you patch today. The upgrade closes the hole. It does not remove an admin account, guardrail or callback that someone added through it.

This Week:

  1. Find every LiteLLM instance. Search container registries, Helm releases and requirements.txt files for litellm, including the proxies individual teams stood up for their own coding agents. Record the version and image digest of each.
  2. Upgrade to 1.83.14-stable or later, pinned by digest. Do not move to "latest," and confirm you are not on 1.107.0.
  3. Block POST /guardrails/test_custom_code at your reverse proxy on any instance you cannot upgrade today, as the GitHub advisory recommends. Keep the admin UI and management API off the public internet.
  4. List every account with proxy_admin and compare it with the people who actually run the gateway. Any internal_user that became an admin without a ticket is an incident.

This Month:

  1. Audit what an attacker would leave behind. Obsidian's list is the checklist: every custom-code guardrail, and every entry in litellm_settings.callbacks in config.yaml, verified against what you deployed.
  2. Rotate provider keys, database credentials and MCP tokens on any instance that ran a vulnerable build with more than a handful of trusted users. Our October rotation guide covers the order.
  3. Run the container as a non-root user, as X41 recommends, so the next sandbox escape does not start as root.
  4. Put spend caps and per-model key scopes at the provider, below the gateway, so a hijacked gateway cannot run up the six-figure days GTIG describes. Also alert on bursts of max_tokens=1 requests, which the report flags as key-validation sweeps.

The Bottom Line

A self-hosted AI gateway now sits where the VPN concentrator sat in earlier cycles: one box that holds trust for the whole company, often run by a platform team that treats it as a developer tool and patches it on a developer schedule. If a gateway is still the right architecture for you (our gateway buyer's guide argues it often is), it needs an owner, a patch SLA and a key-rotation runbook that works without someone looking up how.

CISA's guidance on the old directive, since superseded by BOD 26-04, said known exploited vulnerabilities "should be the top priority for remediation." For LiteLLM users, that means version 1.83.14-stable and a proxy_admin list reviewed by December 2.

Continue Reading

Share:

Frequently Asked Questions

What is CVE-2026-40217 in LiteLLM?

It is a sandbox escape in LiteLLM's custom-code guardrail feature. CISA says it lets remote attackers execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code endpoint. CISA added it to the Known Exploited Vulnerabilities catalog on November 18, 2026, with a federal due date of December 2, 2026.

Which LiteLLM version fixes CVE-2026-40217?

The GitHub advisory's metadata says 1.83.10 and its text says 1.83.11. Obsidian Security says 1.83.14-stable is the first release with the complete fix for CVE-2026-40217 and the two companion privilege escalation bugs, CVE-2026-47101 and CVE-2026-47102. Use 1.83.14-stable or later, pinned by image digest.

Does an attacker need admin access to exploit CVE-2026-40217?

The advisory says reaching the endpoint requires a proxy-admin credential in default configurations. On unpatched builds, CVE-2026-47101 and CVE-2026-47102 let a default internal_user escalate to proxy_admin, so any user with gateway access can be a starting point.

What should I do if I cannot upgrade LiteLLM right away?

Block POST /guardrails/test_custom_code at your reverse proxy, keep the admin interface off the internet, and list every proxy_admin account. Then upgrade as soon as possible, audit custom-code guardrails and config.yaml callbacks, and rotate provider keys if a vulnerable build had untrusted users.

Newsletter

More on AI Security, every Sunday

The week's enterprise AI news, AI Security included, in one Sunday email.

Weekly, free. Unsubscribe any time. Privacy

Latest Articles

View All →