News AI Security

LiteLLM guardrail sandbox escape lands in CISA KEV, sources disagree on the fix

CISA has added CVE-2026-40217, a sandbox escape in the custom-code guardrail test endpoint of BerriAI LiteLLM, to its Known Exploited Vulnerabilities catalog. The flaw gives code execution in the AI gateway's proxy process, and the advisory and researchers do not agree on which release fully fixes it.

Published
Line art of a guardrail with a gap in it beside a gateway icon, with the headline about the LiteLLM sandbox escape in CISA KEV

Key takeaways

  • CVE-2026-40217 is a sandbox escape in LiteLLM's custom-code guardrail test endpoint, now listed by CISA as exploited.
  • It gives code execution in the proxy process, which runs as root in the default Docker image and holds provider API keys.
  • The advisory calls it admin-only, but privilege escalation bugs reported by Obsidian Security chain into it.
  • The advisory metadata, the advisory text and Obsidian Security each name a different fixed release, so treat the latest of the three as the minimum and pin a vetted release.
  • Blocking POST /guardrails/test_custom_code at the reverse proxy is the interim mitigation.

CISA added CVE-2026-40217 in BerriAI LiteLLM to the Known Exploited Vulnerabilities catalog on November 18, with a federal due date of December 2, according to a Cloud Security Alliance (CSA) research note. The flaw itself was disclosed months ago. The news is that it is now confirmed exploited.

A guardrail that runs your code #

Per the GitHub advisory, POST /guardrails/test_custom_code runs user-supplied Python in a hand-rolled sandbox that can be escaped with bytecode-level techniques. The result is code execution in the proxy process, which runs as root in the default Docker image.

LiteLLM is an AI gateway. It holds the provider API keys for the models behind it, so code execution on the proxy exposes all of them.

Admin-only, and still exploited #

The GitHub advisory rates the flaw High, not Critical, and states: "Reaching the endpoint requires a proxy-admin credential in default configurations."

That did not keep it off KEV. The CSA note describes a chain reported by Obsidian Security, CVE-2026-47101 and CVE-2026-47102, that lets a default internal user become a proxy admin, which then leads to code execution through CVE-2026-40217. The note adds that X41 scores the flaw higher than GitHub does, on the basis that low privileges are enough.

On exploitation, the CSA note cites Google Threat Intelligence Group (GTIG) and Mandiant as reporting that a threat cluster used the CVE in LLMjacking intrusions to turn limited-access Virtual Keys into full proxy admin credentials. The CSA also flags an unresolved inconsistency in how two GTIG publications describe the bug. CISA's entry names no actor or victim, and marks known ransomware use as Unknown, per the CSA.

Which release is safe? #

The sources disagree, and none should be read as definitive:

  • The GitHub advisory's metadata lists one release as patched.
  • The same advisory's text tells users to upgrade to the release after that.
  • Obsidian Security, as relayed by the CSA, identifies a later stable release as the first with the complete fix set for all three CVEs.

The practical answer, per the CSA note, is to treat the later stable release Obsidian identifies as the minimum, pin a vetted release by version and image digest instead of a floating tag, and check the version inside each running container.

What to do #

  • Upgrade LiteLLM to a vetted release at or above the one Obsidian identifies, pinned by version and image digest. Per the advisory, the fix replaces the hand-rolled sandbox with RestrictedPython.
  • Until then, block POST /guardrails/test_custom_code at the reverse proxy or API gateway, the interim mitigation in the advisory.
  • Treat provider API keys on any exposed proxy as at risk, and review who holds proxy admin rights.
  • Audit other AI platforms for the same pattern: a safety or testing feature that executes user-supplied code in a homemade sandbox.

Sources

  1. LiteLLM has a sandbox escape in custom-code guardrail · CVE-2026-40217 · GitHub Advisory Database · GitHub, GitHub Advisory Database
  2. Guardrails as an Execution Channel: LiteLLM CVE-2026-40217 Enters KEV, Cloud Security Alliance
  3. Known Exploited Vulnerabilities Catalog, CISA

Questions this raises

What is CVE-2026-40217?
It is a sandbox escape in BerriAI LiteLLM. The POST /guardrails/test_custom_code endpoint runs user-supplied Python in a hand-rolled sandbox that can be escaped, giving code execution in the proxy process.
Why is an admin-only flaw in the KEV catalog?
The GitHub advisory says reaching the endpoint needs a proxy-admin credential in default configurations. A CSA research note describes separate privilege escalation flaws that let a default internal user become a proxy admin, and cites GTIG and Mandiant as reporting use of the CVE in LLMjacking intrusions.
Which LiteLLM release fixes it?
The sources disagree. The GitHub advisory's metadata and its text name different releases, and Obsidian Security, as relayed by the CSA, names a later stable release as the first with the complete fix set. Per the CSA note, upgrade to a vetted release at or above the one Obsidian identifies, pin it by version and image digest, and verify what is deployed.

LiteLLMai-gatewayCISA KEV