LiteLLM guardrail sandbox escape gives code execution on AI gateways, exploited per CISA
A test endpoint in LiteLLM's proxy runs attacker-supplied Python outside its sandbox. CISA added the flaw to KEV on 2026-11-18. Upgrade to 1.83.11 or later, or block POST /guardrails/test_custom_code.
What you need to know
- Exposure: LiteLLM proxy (pip litellm) from 1.81.8. The advisory lists versions below 1.83.10 as affected but says the fix is in 1.83.11. Red Hat AAP 2.6, OpenShift AI 3.3 and Lightspeed Core bundle LiteLLM.
- Impact: a proxy-admin caller can run arbitrary Python, as root in the default Docker image. This exposes provider API keys, the master key and database credentials.
- Exploitation: in CISA KEV since 2026-11-18, with a federal due date of 2026-12-02. Google reports exploitation in an LLMjacking intrusion. A public PoC and a Nuclei template exist.
- Fix: upgrade to 1.83.11 or later (1.84.0+ also covers related LiteLLM flaws). If you cannot upgrade yet, block POST /guardrails/test_custom_code at the reverse proxy.
- Detect: search proxy logs for POST /guardrails/test_custom_code and audit the guardrails list for entries you did not create. If you were exposed before patching, rotate all keys.
What's happening
CVE-2026-40217 is a sandbox escape in the custom-code guardrail feature of BerriAI's LiteLLM proxy, an AI gateway that fronts model providers 2. A caller who can reach POST /guardrails/test_custom_code can run arbitrary Python inside the proxy process, which runs as root in the default Docker image 2. The vendor lists pip litellm 1.81.8 up to but not including 1.83.10 as affected, but says the fix shipped in 1.83.11, so treat 1.83.10 as possibly vulnerable 2. NVD also lists Red Hat Ansible Automation Platform 2.6, OpenShift AI 3.3 and Lightspeed Core, which bundle LiteLLM 7.
By default the endpoint requires a proxy-admin credential 2. Weak deployments lower that bar. In research on related LiteLLM flaws, Wiz found that 294 of 3,074 internet-exposed gateways (about 9.6%) accepted the documented example master key sk-1234 11. The Hacker News also reports that a deployment with no master key configured treated every caller as a proxy administrator 11.
CISA added the flaw to its Known Exploited Vulnerabilities catalog on 2026-11-18, with a due date of 2026-12-02 and ransomware use listed as unknown 1. Google Threat Intelligence Group says that in one LLMjacking intrusion, an actor exploited CVE-2026-40217 to turn standard LiteLLM virtual keys into full admin credentials 8,9. Google's LLMjacking report describes the exploited bug as a user ID rebind issue on /key/regenerate, which does not match the vendor's description. The precise attack path is therefore unconfirmed 9. No actor has been named for this CVE, and no first-seen date is public. Press coverage repeats the same Google findings 10.
How it works
The guardrail test endpoint executes user-supplied Python inside a hand-rolled sandbox, and the vendor says bytecode-level techniques can escape it 2. X41 D-Sec, which found the bug, says the endpoint tried to block dangerous operations by regex-filtering the submitted source. That filter can be bypassed to gain code execution on the server 5. The fix replaces the custom sandbox with RestrictedPython 2.
Exploitation takes one authenticated HTTP API request, and X41's test setup used the master key 5. The CNA and Red Hat score it CVSS 3.1 8.8 with low privileges required 3,6. The GitHub advisory scores it lower, at CVSS 4.0 7.5, and rates both attack complexity and required privileges as high 2. The CNA and CISA classify the weakness as CWE-420 1,6. X41 and Red Hat use CWE-94 (code injection) 3,5.
The impact reaches beyond one host. According to The Hacker News, full control of a LiteLLM gateway exposes the master key, the salt key that decrypts stored credentials, the database URL and every configured provider key. It also exposes the prompts and responses flowing through the gateway 12. LiteLLM has several related guardrail and authentication flaws under separate CVE IDs. Check each one rather than assuming this patch covers them all.
What to do
In order of priority- 1
Upgrade LiteLLM to 1.83.11 or later. The advisory text names 1.83.11 as the fix, although its metadata says 1.83.10 2. The Hacker News recommends 1.84.0 or later to clear related LiteLLM flaws as well 11.
- 2
Red Hat customers: confirm fixed builds for affected products with Red Hat. NVD data references errata RHSA-2026:24866 and RHSA-2026:30056 7. Red Hat states that no mitigation meeting its criteria is available 3.
- 3
If you cannot upgrade immediately, block
POST /guardrails/test_custom_codeat the reverse proxy or API gateway, as the vendor advises 2. - 4
Set a strong, unique master key and never run the proxy without one. Restrict
POST /guardrailsandPUT /guardrails/{guardrail_id}to administrators, and keep admin endpoints off the internet 11. - 5
Limit the blast radius. Restrict the container's outbound network access and give the workload a narrow cloud IAM role 11. Avoid running the proxy as root, which is the Docker image default 2,5.
- 6
Assume breach if the gateway was exposed before patching. Remove unknown guardrails and restart the process to clear code held in memory. Rotate the master key, database credentials and all provider keys 11. Treat the salt key and all traffic through the gateway as exposed 12.
- 7
US federal agencies must apply mitigations, follow CISA forensic triage guidance, or stop using the product by 2026-12-02 1. Google advises bringing model gateways such as LiteLLM into routine vulnerability management 9.
Detection
- Search reverse-proxy, API gateway and LiteLLM access logs for
POST /guardrails/test_custom_code, the vulnerable endpoint 2. Treat any call from a non-administrator key or an unexpected source IP as suspect. - Audit the guardrails list for custom-code guardrails you did not create. Upgrading does not remove a guardrail an attacker registered 11.
- Check LiteLLM key records for virtual keys that gained admin rights, and for unexpected key regeneration calls (
/key/regenerate). Google describes an attacker escalating virtual keys to PROXY_ADMIN 8,9. - Watch for child processes such as shells, curl or package managers spawned by the LiteLLM Python process, and for unexpected outbound connections from the gateway container.
- In connected cloud accounts, look for newly created IAM or service accounts, admin policies attached to service roles, SSH keys injected into instances, and service accounts posing as billing-optimization tools 9,13.
- Watch model-provider billing and usage for sudden spikes. Google reports LLMjacking charges above $100,000 in a single day in individual incidents, and cumulative charges of up to $1 million at some organizations 9,10.
- Check Point IPS covers the flaw as CPAI-2026-7889 4. A Nuclei template exists for exposure checks, but its metadata cites an incorrect version range, so confirm the version directly 14,2. Also confirm your gateway rejects
sk-123411.
Indicators
As published by the cited sources| Type | Value | Context |
|---|---|---|
| url path | /guardrails/test_custom_code | Vulnerable endpoint and a legitimate admin feature; use as a hunting pivot, not a malicious indicator on its own.2 |
Timeline
X41 D-Sec publishes advisory X41-2026-001 with a proof of concept; no CVE ID or fixed version named yet. 5
CVE-2026-40217 published by the MITRE CNA. 6
BerriAI publishes GitHub advisory GHSA-wxxx-gvqv-xp7p with the fix (v1.83.10-stable; text says 1.83.11). 2
Check Point releases IPS protection CPAI-2026-7889. 4
Google Threat Intelligence Group publishes LLMjacking report citing exploitation of CVE-2026-40217 against a LiteLLM gateway. 9
Help Net Security reports Google findings that CVE-2026-40217 was exploited in LLMjacking activity. 10
CISA adds CVE-2026-40217 to KEV, due date 2026-12-02. 1
Sources
- 1Known Exploited Vulnerabilities Catalog: CVE-2026-40217CISA · Government · Nov 18, 2026
- 2LiteLLM has a sandbox escape in custom-code guardrail (GHSA-wxxx-gvqv-xp7p)BerriAI / GitHub Advisory Database · Vendor · May 7, 2026
- 3CVE-2026-40217 - Red Hat Customer PortalRed Hat · Vendor
- 4CPAI-2026-7889 LiteLLM Remote Code Execution (CVE-2026-40217)Check Point · Vendor · Jun 23, 2026
- 5Advisory X41-2026-001: Guardrail Sandbox Escape in LiteLLMX41 D-Sec · Research · Apr 8, 2026
- 6CVE Record CVE-2026-40217CVE Program / MITRE · Database · Apr 10, 2026
- 7NVD CVE-2026-40217NIST · Database
- 8GTIG AI Threat Tracker: Agentic Threat Activity Crosses a Significant ThresholdGoogle Threat Intelligence Group · Research
- 9The Rise of LLMJacking: How Threat Actors Monetize Compromised Cloud and Model ResourcesGoogle Threat Intelligence Group · Research · Nov 2, 2026
- 10Stolen AI access leaves companies with cloud bills of up to $1 millionHelp Net Security · News · Nov 3, 2026
- 11Nearly 1 in 10 Exposed LiteLLM Gateways Accepted the Example 'sk-1234' Admin KeyThe Hacker News · News
- 12LiteLLM Vulnerability Chain Lets Low-Privilege Users Take Over AI Gateway ServersThe Hacker News · News
- 13
- 14nuclei-templates releases (CVE-2026-40217 template)ProjectDiscovery · Database
Corroborated by independent sources. Researched and drafted by the VulnDigest briefs agent from 14 sources, then checked against them by a separate review step on Nov 18, 2026.
The KEV listing details (added 2026-11-18, due 2026-12-02) come from CISA's catalog feed. The cisa.gov catalog page itself could not be loaded at check time.
Google's LLMjacking report describes the exploited flaw as a /key/regenerate user ID rebind, not the vendor's sandbox escape. CISA lists the CVE as exploited, but the attack path Google observed is unclear.
The vendor advisory gives two fixed versions: its metadata says 1.83.10 and its text says 1.83.11. Treat 1.83.10 as possibly vulnerable and install 1.83.11 or later.
The vendor has made no statement on exploitation. No actor or first-seen date is public, and press coverage traces back to a single Google report.
Fixed builds for the affected Red Hat products could not be confirmed. Check Red Hat errata directly.
The Nuclei template's version metadata (< 1.25.0) contradicts the vendor's affected range. Rely on the vendor range.
Spotted an error? Open an issue on sochub.io.