CISA Lists LiteLLM’s Guardrail Sandbox Escape as Exploited, Seven Months After the Fix Shipped
CVE-2026-40217 lets a caller run code on a LiteLLM proxy through its custom-code guardrail tester, and CISA says it is exploited. The fixed version, why the scores disagree, and what to check in your logs today.

In this article
Table of Contents
Table of contents
CISA added a LiteLLM flaw, CVE-2026-40217, to its Known Exploited Vulnerabilities catalogue on Wednesday 18 November. The bug sits in a feature of the open-source AI gateway that lets users test custom Python guardrail code: a request to one endpoint, /guardrails/test_custom_code, can be turned into arbitrary code execution on the server. CISA’s entry gives a due date of Wednesday 2 December for US federal agencies and says it does not know whether ransomware groups are using the flaw. It does not say who is exploiting it, or how often. The fix is not new: the maintainers’ own advisory points to a release that has been on PyPI since April.
#What the endpoint does, and where the sandbox gives way
LiteLLM is a proxy that gives applications one OpenAI-style API in front of many model providers, with cost tracking, rate limits and guardrails for filtering requests and responses. According to the security firm X41 D-Sec, which reported the problem, administrators can define guardrails as custom Python, and the proxy exposes an endpoint where authenticated users can submit a function to test it. The proxy then runs that code.
X41’s advisory says the server tries to make this safe with regular-expression filtering of the source code, blocking names such as the ones that would give access to Python’s built-in functions. The firm says that filtering looks only at the text of the code, and can be bypassed with techniques that rewrite the compiled bytecode at run time, so the attacker’s code ends up with the real import machinery and can run operating system commands. X41 reports that in the default DockerThe KBY LexiconDockerDocker packages an application and its dependencies into a portable, isolated container using OS-level virtualisation, distinct from full virtual machines. image the proxy process runs as root. We are not reproducing the technique; the vendor advisory and the CVE record are enough to act on.
The CVE record, published on Friday 10 April, describes the weakness in one sentence: remote attackers can execute arbitrary code through bytecode rewriting at that URI, in LiteLLM “through 2026-04-08”. CISA’s catalogue entry uses the same description and classes the weakness as CWE-420, an unprotected alternate channel. Red Hat’s own page for the CVE records the flaw against LiteLLM and says it has no mitigation that meets its criteria for widespread use.
#Moderate or high? The scores disagree, and so does the precondition
The published ratings are far apart. LiteLLM’s GitHub advisory, titled “Sandbox escape in custom-code guardrail”, rates it Moderate, with a CVSS 4.0 score of 5.9. It says that in default configurations the caller needs a proxy-admin credential to reach the endpoint. X41 rates the same flaw High, with a CVSS 4.0 score of 8.7, and describes the attack vector as an authenticated HTTPThe KBY LexiconHTTPHTTP is a stateless application-level protocol for request and response messages. Safe validation requires a bounded target and both protocol and application evidence. API request. The CVE record carries a CVSS 3.1 score of 8.8 from secondary sources.
These are not contradictory so much as answers to different questions. The vendor scored the flaw assuming a locked-down proxy where only administrators hold the keys. X41 scored what an attacker gets once they hold any valid key that can reach the endpoint. In our view the second reading is the one that matters for most real deployments, because LiteLLM proxies are typically handed to teams, scripts and test environments as shared infrastructure, and a key that was issued for “just calling a model” tends to spread. Whether your proxy limits that endpoint to administrators is a configuration fact you can check; do not assume it.
CISA’s listing tells us one thing the scores cannot: someone has used this against a real system, or CISA has seen reliable evidence that they have. The entry does not say who, against what, or whether the attacker had an admin key or found another way to one. Treat that gap as a reason to look at your own logs, not as reassurance.
#A fix that has been available since April
The GitHub advisory, published on Thursday 7 May, lists the affected range as 1.81.8 up to but not including 1.83.10. It says the hand-rolled sandbox was replaced and tells users to upgrade to 1.83.11 or later. The advisory has an inconsistency worth knowing about: its “patched versions” field says 1.83.10 or later, while the text says the fix is in 1.83.11. We would follow the text and take 1.83.11 as the minimum.
PyPI’s release history shows both versions exist: 1.83.10 was uploaded on Sunday 19 April, 1.83.11 on Wednesday 22 April and 1.83.12 the next day. The current release on PyPI is 1.110.1. So the flaw was fixed in a release published about seven months before CISA’s listing, and anyone running a version from the last few months of releases is almost certainly past it. The exposure is in the long tail: installations pinned to an old version, container images that were pulled once and never refreshed, and anything that tracked a floating tag at the wrong moment. X41’s advisory confirms the problem against the main-latest Docker image as it stood when they tested it, and its own table lists patched versions as to be determined, so the vendor advisory remains the better guide to fixed versions.
That gap between a quiet fix and a catalogue entry is the pattern we would watch. A moderate rating on the original advisory meant many teams filed it under “later”. We expect the KEV listing to be the nudge that moves it up. We also expect to see more of this with AI gateways and agent tooling generally: they are young, fast-moving, run with broad credentials and often sit outside the patching routines that cover operating systems and browsers. Our report on the compromised Microsoft Agent Framework releases earlier this week, covered here, comes from the same corner of the stack.
#Who needs to act, and who can stop reading
You are affected if you run the open-source LiteLLM proxy, in a container or from the Python package, at a version in the advisory’s range, or on an old image whose version you cannot state. If you only call a hosted LiteLLM service, or use the library to call models from your own code without running the proxy server, the endpoint is not yours to defend, though the vendor of any hosted service you use may want a question from you.
Exposure is highest where the proxy is reachable from the internet or from a wide internal network, where many people hold keys, and where the process runs as root. The proxy also sits in front of your model providers, so in our reading anything that lets an attacker run code there puts the provider keys, prompts and responses it handles within reach. That is our inference from what the product does, not something the advisories state.
#What we would check today
- Find every LiteLLM proxy you run. Look at container images, deployment manifests and Python environments. For packages,
pip show litellmgives the version. For images, check the tag and when it was pulled; a floating tag proves nothing. - Upgrade to 1.83.11 or later. Better, move to a current release, and pin the version so the next change is one you chose. Read your own release notes before a large version jump; the project has moved from 1.83 to 1.110 since the fix.
- If you cannot upgrade today, block the endpoint. The advisory’s workaround is to block
POST /guardrails/test_custom_codeat the reverse proxy or API gateway. It is a stop-gap, not a fix. - Search your logs for that path. Any request to it from a source you do not recognise, or from a key that has no reason to test guardrails, is worth treating as an incident. Absence of logs for the proxy itself is a finding too.
- Decide who can reach the endpoint. Keep administrator keys few, and keep the admin API off the public internet.
- If anything looks wrong, rotate. That means the proxy’s master key, any virtual keys, and the upstream provider keys it holds, in that order, after you have preserved evidence.
- Stop running it as root. X41 says the default image does; if you build your own, drop privileges.
#Our view
We think the right priority is “this week, ahead of routine patching”, and “today” for any proxy that is internet-facing or widely keyed. The vendor’s Moderate rating was reasonable on the assumption it made, but CISA has now told us that assumption does not hold everywhere. The US due date of 2 December is a federal deadline and not a UK requirement; UK organisations should read it as CISA’s view of how long the risk can wait, which is not very long.
The more useful lesson is about categories. A guardrail tester that executes user-supplied code is a code execution feature by design, and a filter on the source text was never going to be a boundary. The vendor replaced it with a purpose-built restricted execution library, which is the correct direction, and it is worth asking any AI gateway vendor the question we would put to LiteLLM’s: which features run user-supplied code, and what, specifically, contains it? If you cannot get an answer in writing, switch the feature off.
#What we do not know yet
- Who is exploiting the flaw, against which targets, and whether they needed an administrator key first. CISA’s entry does not say.
- Whether the vendor has seen exploitation. Its advisory, dated May, predates the listing and does not mention it.
- Whether any ransomware group is involved. CISA lists that as unknown.
- Which products that bundle LiteLLM are affected. Red Hat’s CVE page lists the flaw but we have not seen a full list of downstream products.
We will update this story if CISA, the vendor or a researcher publishes exploitation detail, or if a bundled product’s advisory changes the picture.
Evidence trail
Sources and verification
Primary documentation and external technical references used in this article.
- 01CISA Known Exploited Vulnerabilities catalogue, entry for CVE-2026-40217cisa.gov
- 02NVD record for CVE-2026-40217services.nvd.nist.gov
- 03X41 D-Sec advisory X41-2026-001, Guardrail Sandbox Escape in LiteLLMx41-dsec.de
- 04BerriAI LiteLLM security advisory, Sandbox escape in custom-code guardrailgithub.com
- 05litellm release history on PyPIpypi.org
- 06Red Hat CVE page for CVE-2026-40217access.redhat.com
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Read-only scripts
- Windows devices with no BitLocker recovery key in Entra IDMicrosoft Entra ID, Windows
- Intune devices that haven't synced in N daysMicrosoft Intune
- Mailboxes forwarding to external addressesExchange Online
- BitLocker status of every volume on this PCWindows
Upcoming deadlines
- Intune moves to macOS 15 and laterQ4 2026
- SAP SuccessFactors provisioning: move from basic auth to workload identityNovember 2026
- Intune November release: JIT registration reminder at APNs renewal and automatic JIT for eligible tenantsNovember 2026
Explore KBY
The KBY Brief
A short email about twice a week with new runbooks, configuration traps and fixes from KBY Technologies.
SubscribeMore news
All news
Platforms and devicesPowerShell 7 Will Ship Inside Windows, and Windows PowerShell 5.1 Is Now Deprecated



Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Get new fixes by email.
New runbooks, configuration traps and fixes from KBY Technologies, about twice a week.
Comments
Add a thoughtful note on CISA Lists LiteLLM’s Guardrail Sandbox Escape as Exploited, Seven Months After the Fix Shipped. Comments are checked for spam and held for moderation before appearing.