Breach Value Calculator

LiteLLM CVE-2026-40217: Upgrade and Block the Guardrail Test Endpoint

LiteLLM CVE-2026-40217 lets custom guardrail code escape its sandbox, and CISA lists it as exploited. Affected versions, the fix and a workaround.

LiteLLM CVE-2026-40217 lets Python code sent to the proxy's custom-code guardrail test endpoint escape its sandbox and run inside the proxy process. CISA lists it as exploited. Upgrade LiteLLM to 1.83.11 or later; if you can't yet, block POST /guardrails/test_custom_code at your reverse proxy or API gateway.

Sources checked 21 November 2026.

LiteLLM is an open-source model gateway: one API in front of many AI models, with keys, budgets and guardrails managed by a proxy you run yourself. For what a gateway sees and holds, see AI routers and model gateways explained; for where it belongs in an agent stack, see AI agent security architecture.

What is LiteLLM CVE-2026-40217?

LiteLLM's GitHub advisory GHSA-wxxx-gvqv-xp7p, "Sandbox escape in custom-code guardrail", was published on 7 May 2026. It says the POST /guardrails/test_custom_code endpoint runs user-supplied Python inside a sandbox, and that "The sandbox can be escaped using bytecode-level techniques, allowing arbitrary code execution in the proxy process". The advisory notes that the proxy runs as root in the default Docker image.

There is a precondition. In a default setup, the advisory says, "Reaching the endpoint requires a proxy-admin credential".

CISA added the flaw to its Known Exploited Vulnerabilities (KEV) catalogue on 18 November 2026 as "BerriAI LiteLLM Unprotected Alternate Channel Vulnerability". Its entry says the flaw "could allow remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI." The due date for US federal civilian agencies is 2 December 2026. In the CVE record, CISA's assessment marks exploitation as "active", automatable as "no" and technical impact as "total".

The scores differ because the assumptions differ. LiteLLM rates the flaw CVSS 4.0 5.9, "Moderate", assuming high privileges (PR:H). The CVE record carries CVSS 3.1 8.8, "High", assuming low privileges (PR:L). Whichever score you read, the KEV listing says the flaw is in use; see CVE, CVSS, EPSS and KEV explained for weighing the signals.

Which LiteLLM versions are affected?

Versions Source
Affected 1.81.8 and later, earlier than 1.83.10 LiteLLM advisory, "Affected versions" field
Fixed 1.83.11 (advisory text); "Patched versions" field says 1.83.10 or later LiteLLM advisory

The advisory's text and its version field disagree on the fixed release, so 1.83.11 or later, which satisfies both, is the safe target.

LiteLLM also ships inside other products. Red Hat's entry in the CVE record lists fixes for Red Hat Ansible Automation Platform 2.6 (RHSA-2026:24866) and Red Hat OpenShift AI 3.3 (RHSA-2026:30056).

What to do now

  1. Find every LiteLLM proxy you run, including test instances and copies inside AI platform or developer tooling, and note each version.
  2. Upgrade to 1.83.11 or later, internet-reachable proxies first. Red Hat customers apply the RHSA for their product.
  3. Can't upgrade yet? LiteLLM's workaround: block POST /guardrails/test_custom_code at your reverse proxy or API gateway.
  4. Tighten the admin credential. The endpoint needs a proxy-admin credential by default, so list who and what holds it. Rotate it if it has ever been shared or committed to code.
  5. Check for misuse. The advisory and the KEV entry give no indicators of compromise. As general practice, search reverse-proxy and gateway logs for requests to /guardrails/test_custom_code, and look for unexpected processes or outbound connections from the proxy container. If anything looks wrong, rotate the model provider keys the proxy holds and bring in incident response help.

Sources

Spotted a mistake? Report a correction.