LiteLLM ships a feature that lets administrators test safety guardrails by sending Python code to the proxy, and that code was supposed to run in a sandbox. It did not stay there: a text filter was the only barrier, and the process behind it runs as root in the default Docker image.
In short: LiteLLM CVE-2026-40217 is a guardrail sandbox escape that gives an authenticated caller code execution on the LiteLLM proxy host. It was public in April 2026, fixed in late April, and added to CISA’s Known Exploited Vulnerabilities catalog on 18 November 2026, which makes it the fourth LiteLLM flaw in that catalog this year. If your gateway was reachable and unpatched, assume its keys are exposed.
- What is LiteLLM CVE-2026-40217?
- How does the guardrail sandbox escape work?
- How did attackers use CVE-2026-40217?
- Timeline: why did it take seven months?
- Who is affected and how do you check?
- How do you detect exploitation?
- How do you mitigate CVE-2026-40217?
- How does it compare with the other LiteLLM KEV entries?
- What is still unknown?
- The bottom line
- Sources
What is LiteLLM CVE-2026-40217?
CVE-2026-40217 is a code-execution flaw in the custom-code guardrail feature of the LiteLLM proxy, published by BerriAI as GitHub advisory GHSA-wxxx-gvqv-xp7p. The vulnerable endpoint, POST /guardrails/test_custom_code, runs user-supplied Python inside what BerriAI calls a hand-rolled sandbox.
LiteLLM is an open-source gateway made by BerriAI that puts one API in front of many model providers, such as OpenAI, Anthropic, Azure and Bedrock. The GitHub repository had 64,160 stars and 13,678 forks when we checked on 30 November 2026.
A guardrail, in LiteLLM’s sense, is a check that inspects prompts or responses before they pass through the gateway, for example to block secrets or unsafe content. Custom-code guardrails let an administrator write that check in Python.
A sandbox is an environment meant to let untrusted code run without touching the rest of the system. X41 D-Sec, the German security firm that found the bug, describes this one as a regex filter on the source text, not a real isolation boundary.
Why is it in the CISA KEV catalog?
CISA’s KEV catalog lists vulnerabilities it has evidence are being exploited. CISA added CVE-2026-40217 on 18 November 2026 under the name “Unprotected Alternate Channel” and gave US federal civilian agencies until 2 December 2026 to fix it. The entry marks known ransomware use as unknown and names no victims.
How does the guardrail sandbox escape work?
This is a conceptual summary of the X41 advisory, not a procedure.
The filter only reads text
The test endpoint accepts Python source and checks it with regular expressions that look for dangerous names, such as the internal attributes that reach Python’s built-in functions and its import system. If the text passes, the code runs.
Python can build what the filter cannot see
According to X41, a caller can assemble blocked names at run time and use Python’s own internals, such as code objects and function attributes, to get back to the real built-in functions. CISA’s entry summarises the route as bytecode rewriting. Once the import machinery is reachable, the caller can run operating system commands.
The process is root
BerriAI’s advisory says the proxy runs as root in the default Docker image, and X41’s proof of concept output showed a root user ID. So a breakout is not limited to the LiteLLM application: it is code execution as the most privileged user in the container.
What changed in the fix?
BerriAI replaced the hand-rolled sandbox with RestrictedPython, a library that compiles Python with restrictions. The Cloud Security Alliance (CSA) points out that the RestrictedPython maintainers themselves say it is not a security boundary, so it should not be the only control.
How did attackers use CVE-2026-40217?
Google Threat Intelligence Group (GTIG) and Mandiant name the CVE in their 3 November 2026 report on LLMjacking. LLMjacking is the theft of paid access to AI models, usually by stealing API keys, cloud credentials or the gateway that holds them.
In Google’s account, one group gained initial access and a follow-on group obtained Virtual Keys that had already been checked to work. That second group exploited the victim’s LiteLLM gateway to raise standard Virtual Keys to full PROXY_ADMIN credentials. A Virtual Key is a key LiteLLM issues to users and apps so they never see the real provider keys.
Google’s 17 November AI Threat Tracker adds that privileged service accounts were enough for persistence without any malware. Google gives no cluster name or confidence level for the LiteLLM step.
How much money is involved?
Google reports that some LLMjacking intrusions produced more than 100,000 US dollars of fraudulent model charges in one day, and that the worst cases reached 1 million dollars before access was cut. Those figures cover LLMjacking as a whole, not LiteLLM incidents alone, and Google does not split them out.
Victims in Google’s reporting were in financial services, retail, technology and transportation, across North America, South America and Asia Pacific. Stolen access was resold through what Google calls LLM Mixers, illicit gateways that resell model access cheaply.
Google describes the bug two ways
Google’s two reports do not agree on what CVE-2026-40217 is. The 3 November report calls it a user ID rebind flaw in the /key/regenerate endpoint. The 17 November tracker calls it a sandbox escape that elevates Virtual Keys.
BerriAI, X41 and CISA all describe the guardrail code-execution bug. The CSA notes that Obsidian Security tracks the key-route abuse and the self-promotion to proxy admin as two separate CVEs, CVE-2026-47101 and CVE-2026-47102. The CSA’s own reading is that the intrusions used the whole chain and Google filed it under one number, but the CSA says it has not confirmed that with Google.
Timeline: why did it take seven months?
The bug was found in February, public in April and fixed by the end of April. It reached KEV in November. X41’s disclosure log explains the early part: the vendor acknowledged the report quickly, then follow-ups went unanswered and one bounced, so the distros mailing list embargo expired and the advisory went out with no patch.
| Date | Event | Source |
|---|---|---|
| 13 Feb 2026 | X41 identifies the flaw and builds a proof of concept | X41 |
| 18 Feb 2026 | LiteLLM acknowledges and promises a fix within about a week | X41 |
| 24 Mar 2026 | Urgent follow-up bounces from the technical contact | X41 |
| 8 Apr 2026 | Embargo ends, X41 publishes advisory X41-2026-001 with no patch | X41 |
| 27 Apr 2026 | LiteLLM v1.83.10-stable released on GitHub | GitHub |
| 7 May 2026 | BerriAI publishes GHSA-wxxx-gvqv-xp7p | GitHub |
| 3 Nov 2026 | Google links the CVE to an LLMjacking intrusion | GTIG, Mandiant |
| 18 Nov 2026 | CISA adds the CVE to KEV | CISA |
| 2 Dec 2026 | US federal remediation deadline | CISA |
Who is affected and how do you check?
You are affected if you run a self-hosted LiteLLM proxy between version 1.81.8 and the fix, according to the GitHub advisory. The LiteLLM Python SDK used only as a library does not expose the proxy endpoint, though you should still check what your containers actually run.
Which version fixes CVE-2026-40217?
Sources give three answers:
| Source | Fixed version it names |
|---|---|
| GitHub advisory metadata | 1.83.10 |
| GitHub advisory text | 1.83.11 or later |
| CSA, citing Obsidian Security | 1.83.14-stable as the full baseline |
The safe reading is to go to 1.83.14-stable or newer. The CSA also warns against litellm==1.107.0 and several floating Docker tags, which it says briefly served a credential stealer on 21 October 2026, citing StepSecurity. Pin by version and image digest.
How hard is it to reach?
The sources disagree on privilege. BerriAI rates it CVSS 4.0 5.9 with high privileges, saying a proxy-admin credential is needed in default configurations. X41 rates it 8.7 with low privileges, because its test needed only a valid key for the proxy, in its case the master key.
An earlier, related advisory matters here. CVE-2026-59821, fixed in 1.82.0-stable, says the production guardrail create and update paths skipped the sandbox, and that in deployments with no master key configured callers could be treated as proxy admins. A proxy with no master key set is much easier to reach.
Quick exposure check
- List every LiteLLM proxy, including staging, laptops and gateways bundled inside other products.
- Read the version from inside the running container, not from a manifest.
- Check whether the admin routes, including
/guardrails, are reachable from the internet or from user networks. - Confirm a master key is set and who holds it.
How do you detect exploitation?
CISA and Google publish no indicators of compromise for this CVE. Detection has to come from your own gateway and billing data. The CSA suggests these checks:
- Reverse proxy and LiteLLM access logs: requests to
/guardrails/test_custom_codeand toPOST /guardrailsorPUT /guardrails/{id}, especially from unusual sources or at unusual times. - Role changes: calls to
/user/updateor/user/bulk_updatethat changeuser_role, and keys created with wideallowed_routes. - Proxy database: unexpected
proxy_adminusers, custom-code guardrails nobody wrote, new callbacks, and modelapi_basevalues that point at unknown hosts. - Container behaviour: the proxy process spawning shells or network tools, which a gateway has no reason to do.
- Provider billing: sudden spend spikes. Google notes that attackers test stolen keys with tiny requests such as
max_tokens=1before using them heavily.
Google’s report names no ATT&CK IDs. The behaviour maps most closely to Exploitation for Privilege Escalation (T1068), Valid Accounts (T1078) and Resource Hijacking (T1496), but that mapping is ours, not Google’s.
How do you mitigate CVE-2026-40217?
In priority order:
- Upgrade every proxy to 1.83.14-stable or later, pinned by digest, and skip 1.107.0.
- Block
POST /guardrails/test_custom_codeat the reverse proxy if you cannot upgrade today. BerriAI and X41 both recommend this. - Separate the admin and management routes from the inference API and keep them on an admin network or VPN.
- Run as non-root. Start the container with an unprivileged user so a breakout does not land as root.
- Lock down the master key. Keep it in a secrets manager, give it to a few named admins and never to API consumers or CI variables.
- Rotate the master key, provider keys, database credentials, Virtual Keys and cloud credentials the container could reach if the proxy was exposed while vulnerable.
- Audit stored configuration. The CSA notes that guardrails and callbacks live in the proxy database and survive an upgrade.
How does it compare with the other LiteLLM KEV entries?
All four LiteLLM entries in KEV this year sit in the proxy, and every one gives an attacker a path to the keys the proxy holds.
| CVE | Type | GitHub advisory | Added to KEV | Fixed in |
|---|---|---|---|---|
| CVE-2026-42208 | SQL injection in API key verification | 20 Apr 2026 | 8 May 2026 | 1.83.7 |
| CVE-2026-42271 | Command execution via MCP stdio test endpoints | 21 Apr 2026 | 8 Jun 2026 | 1.83.7 |
| CVE-2026-59822 | MCP authentication bypass | 30 Jun 2026 | 2 Sep 2026 | 1.84.0 |
| CVE-2026-40217 | Guardrail sandbox escape | 7 May 2026 | 18 Nov 2026 | 1.83.10 |
The pattern looks like other AI infrastructure flaws, such as the GPUStack authentication bypass that was exploited months after its fix. Gateways hold money in the form of keys, so attackers return to them. Amazon’s honeypots saw the same appetite when ARTEX AI agents raided exposed LiteLLM servers for provider keys, and the Cursor breach showed how far a single AI vendor key can travel.
The catch: test endpoints are production code
Two of the four bugs, CVE-2026-42271 and CVE-2026-40217, live in endpoints meant for testing. A feature that runs code on request is a remote execution feature, whatever it is called. If your gateway exposes “test” routes, they need the same protection as anything else.
What is still unknown?
- Victims. CISA names none, and Google gives no count of LiteLLM intrusions.
- The exact bug Google saw. Google describes CVE-2026-40217 two different ways, and the CSA’s three-CVE explanation is unconfirmed.
- The fixed version. 1.83.10, 1.83.11 and 1.83.14 all appear in sources.
- Severity. BerriAI says 5.9 with high privileges, X41 says 8.7 with low privileges.
- Key theft and cryptomining. Some vendor blogs say attackers stole provider keys and ran miners through this CVE. We found no primary source for that and left it out.
The bottom line
LiteLLM CVE-2026-40217 is not an unauthenticated internet worm. It is a code-execution door behind an admin key, and Google’s reporting shows attackers who already had keys found a way to use it.
Upgrade to 1.83.14-stable or later, take the guardrail test endpoint off the network, stop running the proxy as root, and treat every key on an exposed gateway as burned.
Sources
- CISA: Known Exploited Vulnerabilities catalog (JSON feed, release 2026.11.27)
- BerriAI: GHSA-wxxx-gvqv-xp7p, Sandbox escape in custom-code guardrail
- BerriAI: GHSA-72m8-9m7m-h278, Custom Code Guardrails production endpoints bypass code safety checks
- X41 D-Sec: Advisory X41-2026-001, Guardrail Sandbox Escape in LiteLLM
- Google Threat Intelligence Group and Mandiant: The Rise of LLMJacking
- Google Threat Intelligence Group: GTIG AI Threat Tracker, Agentic Threat Activity Crosses a Significant Threshold
- Cloud Security Alliance: Guardrails as an Execution Channel, LiteLLM CVE-2026-40217 Enters KEV
- The Terminal: LiteLLM CVE-2026-40217, exploited, fixed in 1.83.10
- Vijilan: LiteLLM CVE-2026-40217, What the Active KEV Exploitation Means for AI Gateways
- GitHub: BerriAI/litellm repository and releases
This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.