{"slug": "litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy", "title": "LiteLLM CVE-2026-40217 Is Exploited From Virtual Keys. How to Check Your Proxy", "summary": "LiteLLM proxy versions 1.81.8 through 1.83.10 contain a sandbox-escape vulnerability, CVE-2026-40217, that lets attackers escalate virtual inference keys to administrative credentials and then execute code as root in the default Docker image. CISA added the flaw to its Known Exploited Vulnerabilities catalog on November 18, 2026, with a December 2 remediation deadline for federal agencies, after Google's Threat Intelligence Group reported in-the-wild exploitation. The fix, which replaces the regex deny-list with RestrictedPython, was merged in April and shipped in 1.83.10 per the advisory metadata (1.83.11 per the advisory text), with the full privilege-escalation chain closed in v1.83.14-stable.", "body_md": "If you run a LiteLLM proxy, the box sitting in front of your OpenAI, Anthropic and Gemini accounts has a code execution bug that attackers are using right now. CISA added LiteLLM CVE-2026-40217 to its Known Exploited Vulnerabilities catalog on November 18, 2026, with a December 2 deadline for federal agencies ([Mallory summary of the KEV addition](https://mallory.ai/stories/01a1f125-fa0c-7bc8-8018-acabeaaacd03)). Google says it watched a threat actor use it to turn ordinary virtual keys into admin credentials.\n\nThe fix was merged on April 15. If your proxy hasn't been upgraded since spring, here is how to check the version, what to upgrade to (it isn't the version the advisory names), which logs to grep and which keys to rotate.\n\nLiteLLM lets you write custom guardrails in Python. To test one, the proxy exposes `POST /guardrails/test_custom_code`, which runs whatever code you send it inside a hand-rolled sandbox. That sandbox was a regex deny-list over the source text. X41 D-Sec showed you could build the blocked names at runtime so the regex never sees them, then rewrite a generator's bytecode to reach the real import machinery and run OS commands ([X41 advisory](https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm)). In the default Docker image the proxy runs as root, so \"code execution in the proxy process\" means root in the container.\n\nThe facts, from the [GitHub advisory GHSA-wxxx-gvqv-xp7p](https://github.com/advisories/GHSA-wxxx-gvqv-xp7p):\n\n| Affected | `litellm` >= 1.81.8, < 1.83.10 (the endpoint first shipped in 1.81.8) | \n| Fixed | 1.83.10 in the advisory metadata, 1.83.11 in the advisory text | \n| CVSS | 8.8 (v3.1, [Red Hat](https://access.redhat.com/security/cve/cve-2026-40217) ); 7.5 High (v4.0, GHSA) | \n| CWE | CWE-420 Unprotected Alternate Channel, CWE-913 | \n| EPSS | 17.02% (97th percentile, per GHSA) | \n\nThe fix replaced the regex filter with RestrictedPython.\n\nThat's the argument I keep seeing for putting this one off. The advisory does say reaching the endpoint takes a proxy-admin credential. In practice that requirement is weaker than it sounds, for two reasons.\n\nFirst, Obsidian Security published a chain in June that starts from a default `internal_user` ([Obsidian write-up](https://www.obsidiansecurity.com/blog/litellm-privilege-escalation-rce)). CVE-2026-47101: `/key/generate` (and `/key/update`, `/key/regenerate`) stored a caller-supplied `allowed_routes` without validating it, so a non-admin could mint a key that reaches admin routes. CVE-2026-47102: `/user/update` let you set your own `user_role` to `proxy_admin`. CVE-2026-40217 is the last step, from admin to shell. The full chain was closed in v1.83.14-stable, released April 25.\n\nSecond, the in-the-wild exploitation matches that pattern. Google's Threat Intelligence Group wrote on November 17 that they \"observed a threat actor exploit CVE-2026-40217, a sandbox escape in LiteLLM that allows an attacker to elevate limited-access inference keys (\"Virtual Keys\") into full administrative credentials\" ([GTIG AI Threat Tracker](https://cloud.google.com/blog/topics/threat-intelligence/agentic-threat-activity-crosses-a-significant-threshold)). The same report notes that in the intrusions it covers, privileged service accounts were enough for persistence and the attackers didn't need malware at all.\n\nSo a virtual key, the kind you hand to every internal app and every intern's notebook, became the keys to the gateway. Those keys end up in `.env` files, CI logs and Slack. Whatever \"PR:H\" says, a credential that widely shared is not a high bar.\n\nWhat attackers do with that access is LLMjacking. The same GTIG report cites Mandiant incidents from 2026 where \"single-day fraudulent charges exceeded $100,000 USD\" and, in the worst cases, \"cumulative resource abuse reached $1 million USD before remediation.\"\n\n```\npip show litellm | grep -i '^version'\ndocker ps --format '{{.Names}}\\t{{.Image}}' | grep -i litellm\ndocker exec <litellm-container> sh -c \"find / -maxdepth 7 -type d -name 'litellm-*.dist-info' 2>/dev/null\"\ndocker exec <litellm-container> pip show litellm | grep -i '^version'\n```\n\nRun the version check even if the tag looks fine. If you deploy `main-latest` or `main-stable`, the tag tells you nothing about what's inside the container.\n\nI run `find` before `pip show` on purpose. If a container pulled one of the poisoned October images (more on that below), starting Python re-runs the malware's `cook.pth` and `sitecustomize.py`, and `pip` is Python. LiteLLM's incident report says not to run `pip` in an affected environment first. `find` reads the version off the `dist-info` directory name without starting an interpreter. If it prints `litellm-1.107.0.dist-info`, stop and go to the IOC section.\n\n```\nhelm list -A | grep -i litellm\nhelm get values <release> -n <namespace> | grep -iA3 image\nkubectl get pods -n <namespace> -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.spec.containers[*].image}{\"\\n\"}{end}' | grep -i litellm\nkubectl exec -n <namespace> <litellm-pod> -- pip show litellm | grep -i '^version'\n```\n\nThe chart version and the app version are different numbers. Trust what's installed inside the pod (same `find` trick applies before `pip show`).\n\nIf you're between 1.81.8 and 1.83.9, you're exposed to this CVE. If you're below 1.83.14, you're exposed to the chain that makes it reachable from a normal key.\n\nThe advisory's 1.83.10/1.83.11 disagreement is a distraction. Don't aim for the minimum. I treat v1.83.14-stable as the floor, because that's where Obsidian confirms the whole chain is closed.\n\nOctober's supply-chain compromise makes picking a target messier. On October 21, LiteLLM's own PyPI package and Docker images were compromised: `litellm==1.107.0` and the `v1.107.0`, `latest`, `main-latest` and `main-stable` tags on Docker Hub and GHCR shipped a credential stealer, for about 1 hour 45 minutes on PyPI and about 2.5 hours on Docker Hub ([LiteLLM incident report](https://docs.litellm.ai/blog/security-incident-oct-21-2026)). The project recommends pinning `litellm==1.106.2` or another explicit version published before the incident. The first releases signed with its new cosign key, `v1.103.8`, `v1.104.6`, `v1.105.4` and `v1.106.3`, came out October 24.\n\nSo:\n\n```\npip install \"litellm[proxy]==1.106.2\"   # or a newer, explicitly pinned, signed release\n```\n\nFor Docker and Helm, pin an explicit version tag or, better, a digest. Floating tags are exactly how people got burned in October.\n\nIf you can't upgrade today, block the endpoint at the reverse proxy. Both GitHub and X41 document this workaround:\n\n```\nlocation = /guardrails/test_custom_code {\n    return 403;\n}\n```\n\nNormal chat and completion traffic never touches the guardrail test endpoint, so any hit you can't attribute to a teammate is a red flag ([HOL write-up](https://hol.org/blog/cve-2026-40217-litellm-guardrail-sandbox-escape-cisa-kev)).\n\n```\ngrep 'POST /guardrails/test_custom_code' /var/log/nginx/access.log*\ndocker logs <litellm-container> 2>&1 | grep 'test_custom_code'\n```\n\nThen look at the steps before it in the chain:\n\n`/key/generate`, `/key/update` or `/key/regenerate` that set `allowed_routes`, especially wildcards.`/user/update` or `/user/bulk_update` that change `user_role`.` proxy_admin` account you don't recognize. Re-verify every single one.`POST /guardrails`, `PUT /guardrails/{id}`).` litellm_settings.callbacks` in `config.yaml`. Obsidian points out these don't show in the admin UI, and a malicious callback can read prompts and responses or alter tool calls.\nWhile you're in there, check for the October supply-chain IOCs too: `litellm-1.107.0.dist-info`, `cook.pth`, `cook.py` or `sitecustomize.py` in site-packages, and `/tmp/remote_code_loader.lock`. LiteLLM is explicit that finding them confirms exposure but not finding them doesn't prove you're clean.\n\nUpgrading keeps the next attacker out. If someone got in before you patched, it does nothing about them.\n\nA LiteLLM proxy is a credential vault with an HTTP API. It holds every provider key in its database or config, the master key, the `DATABASE_URL` password and whatever else is in its environment. With root in that container, an attacker reads all of it in seconds and never needs to come back. Your logs may be incomplete, or the attacker may have cleaned them, and the absence of a `test_custom_code` hit in nginx doesn't help if someone reached the proxy directly on port 4000.\n\nRotate, in this order:\n\n`LITELLM_MASTER_KEY`.\nIt's an annoying afternoon, but a $100,000 day on your cloud and LLM bills is worse.\n\nAnd take the admin UI and management routes off the public internet. The proxy needs to serve `/chat/completions` to your apps. It doesn't need to serve `/user/update` to the whole world.\n\nSo: is your LLM gateway reachable from the internet, and when did you last rotate the provider keys behind it? If you think rotating on every KEV entry is overkill, tell me why in the comments.", "url": "https://wpnews.pro/news/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy", "canonical_source": "https://dev.to/alanwest/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy-2n9k", "published_at": "2026-11-19 16:10:03+00:00", "updated_at": "2026-11-19 16:14:21.998572+00:00", "lang": "en", "topics": ["ai-safety", "ai-infrastructure", "ai-agents", "mlops"], "entities": ["LiteLLM", "CISA", "Google Threat Intelligence Group", "X41 D-Sec", "Obsidian Security", "Mandiant", "Red Hat", "OpenAI"], "also_reported_by": [], "takeaway": null, "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy", "markdown": "https://wpnews.pro/news/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy.md", "text": "https://wpnews.pro/news/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy.txt", "jsonld": "https://wpnews.pro/news/litellm-cve-2026-40217-is-exploited-from-virtual-keys-how-to-check-your-proxy.jsonld"}}