On this page (7 sections)

CISA added CVE-2026-40217, a code execution flaw in the BerriAI LiteLLM proxy, to its Known Exploited Vulnerabilities (KEV) catalog on 2026-11-18. The bug sits in the /guardrails/test_custom_code endpoint, where a homemade Python sandbox can be escaped to run arbitrary code inside the proxy process.

If you run a LiteLLM proxy, especially the default Docker image, which the advisories say runs as root, you should check your version today, upgrade, and make sure that endpoint is not reachable by anyone who does not need it.

What happened

LiteLLM is an open-source proxy that gives applications one OpenAI-compatible API in front of many LLM providers, with features such as load balancing, cost tracking and guardrails. Guardrails can include custom Python code that filters or transforms requests and responses. The proxy exposes a test endpoint, POST /guardrails/test_custom_code, so administrators can try that code out.

Security firm X41 D-Sec published an advisory showing that the restrictions around this test endpoint can be bypassed, leading to arbitrary code execution on the server. The GitHub advisory describes it as a sandbox escape in the custom-code guardrail and says the proxy process runs as root in the default Docker image. The NVD entry classifies it as an unprotected alternate channel vulnerability.

CISA's KEV listing on 2026-11-18 is the basis for the exploitation claim. The sources we reviewed do not say who is exploiting it, how many systems are affected, or what attackers do after gaining access, so treat those details as unknown.

Technical details

The weakness is a classic one: the application runs user-supplied code and relies on a custom filter to keep that code harmless. According to X41 D-Sec, the original defense was regex-based filtering of the source text, which blocks dangerous names only when they appear literally. Because the check looks at source text rather than what the code actually does at runtime, it can be sidestepped, and the result is code running with the privileges of the LiteLLM process. The CVE is tagged with CWE-94 (code injection) and CWE-420 (unprotected alternate channel).

The GitHub advisory states the fix: the hand-rolled sandbox was replaced with RestrictedPython. We are deliberately not reproducing the bypass technique here; the defensive takeaway is that a custom sandbox for untrusted Python is hard to get right, so limit who can reach the feature at all.

Scoring and privilege differences between sources

The sources do not fully agree, so read the numbers with care.

How the sources describe severity and required access
SourceScoreAccess needed
CVE record (NVD data)CVSS 8.8, highNot stated in the description
GitHub advisoryCVSS v4 7.5, highProxy-admin credential in default configurations (privileges required: High)
X41 D-Sec advisoryCVSS 8.7, highAuthenticated HTTP API request (privileges required: Low)
In every description the attacker needs some form of valid credential. How privileged that credential must be differs between the GitHub advisory and X41 D-Sec. Until you have verified your own setup, assume any holder of a working API key could be a risk and restrict the endpoint regardless.

Who is affected

The package data lists litellm on pip as vulnerable from 1.81.8 up to but not including 1.83.10. X41 D-Sec confirmed the issue against the main-latest Docker image at the time of its advisory. Exposure is highest for:

  • LiteLLM proxies reachable from the internet or from broad internal networks.
  • Deployments using the default Docker image, where the process runs as root, so code execution means full control of the container.
  • Setups where many people or services hold admin or API keys, since a stolen or leaked key becomes a path to code execution.
  • Proxies that store upstream LLM provider keys, which an attacker on the host could try to read. The sources do not describe this specifically, but it follows from code execution inside the proxy process.

How to check your exposure

First find out which version you run. This lists the installed litellm package in a Python environment (run it on the host or inside the container); compare the version to 1.83.11.

Show the installed LiteLLM version (pip-based installs)Shell
pip show litellm

For Docker, list the running containers and the images they use. This is read-only; a tag such as main-latest can be old, so confirm the version inside the running container.

List running containers and their images (Docker host)Shell
docker ps --format '{{.Names}} {{.Image}}'

Then check whether anyone has called the vulnerable endpoint. This searches a reverse proxy access log for the path; adjust the log location to your setup. Any hit you cannot explain deserves investigation.

Search an access log for requests to the vulnerable endpointShell
grep 'guardrails/test_custom_code' /var/log/nginx/access.log

What to do now

  1. Upgrade litellm to 1.83.11 or later. The GitHub advisory header lists 1.83.10 as patched while its text says 1.83.11, so choosing 1.83.11 or newer satisfies both.
  2. If you cannot upgrade immediately, block POST /guardrails/test_custom_code at your reverse proxy or API gateway, as the GitHub advisory suggests.
  3. Keep the proxy off the public internet where possible; put it behind a VPN, private network or authenticated gateway.
  4. Review who holds proxy-admin and other API keys, remove unused ones, and rotate any you suspect were exposed.
  5. Search access logs for requests to /guardrails/test_custom_code and investigate any you cannot attribute to a known administrator.
  6. If you find suspicious calls, treat the host as compromised: rotate provider API keys and other secrets the proxy could read, and rebuild the container or server from a clean image.
  7. Where your own policy allows, run the container as a non-root user to limit the damage of any future code execution bug.
Caution. Upgrading usually means restarting or redeploying the proxy, which interrupts LLM traffic for a short time. Plan it for a quiet window and test the new version before pointing production clients at it.

For a pip-based install, this upgrades the package to the fixed release or newer; restart your proxy service afterwards and re-run pip show litellm to confirm the version.

Upgrade LiteLLM in a pip-based install, then restart your proxy serviceShell
pip install --upgrade 'litellm>=1.83.11'

For Docker, pull the updated image, redeploy the container using your normal process, and confirm the running version afterwards.

Detection and monitoring

Beyond the one-time log search, keep an eye out for these signs after patching:

  • Any new request to the guardrails test endpoint from addresses that are not your administrators.
  • Unexpected child processes, outbound connections or new files on the host or container running the proxy.
  • Spikes in usage or cost on your upstream LLM provider accounts, which can indicate stolen keys.
  • Admin or API keys created or used outside normal hours.

A reverse proxy rule that denies the endpoint outright is cheap insurance even after upgrading, since most deployments never need that test route exposed. If the proxy is internet-facing, an outside-in review can show what is reachable from the public side; Webforta Scan looks at externally visible configuration of sites you verify, though it does not replace patching or log review. For more on filtering traffic at the edge, see what a WAF is.

Why the KEV listing matters

CISA's KEV catalog lists vulnerabilities with evidence of active exploitation. This entry has a due date of 2026-12-02 for US federal agencies, with required action to apply vendor mitigations. Private organizations are not bound by that date, but it is a useful signal of urgency. The catalog marks known ransomware use as Unknown, which means no link has been recorded, not that none exists.

If you are building a broader checklist for internet-facing services, the small business website security guide and the Webforta blog cover related basics and recent vulnerability news.

Sources

This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.

  1. CVE-2026-40217 - GitHub Advisory Databasegithub.com
  2. Advisory X41-2026-001: Guardrail Sandbox Escape in LiteLLMx41-dsec.de ·
  3. BerriAI LiteLLM Unprotected Alternate Channel Vulnerability (CVE-2026-40217) is being actively exploitednvd.nist.gov ·
  • LiteLLM
  • CVE-2026-40217
  • CISA KEV
  • RCE
  • AI infrastructure