Your AI Gateway's Guardrail Was the Way In: LiteLLM Bug Hits CISA's Exploited List

Your LLM gateway is the box that holds every provider API key your team owns. Last week CISA said it has evidence that attackers are exploiting one open-source gateway, LiteLLM, through the feature meant to keep it safe: the guardrails.

On November 18, CISA added CVE-2026-40217, a code-execution bug in BerriAI’s LiteLLM, to its Known Exploited Vulnerabilities (KEV) catalog. KEV is the list of bugs CISA has evidence are being exploited in the wild. Not “could be.” Are.

The fix has been out since April. If you run LiteLLM and haven’t upgraded since spring, this one’s your Thanksgiving homework.

What happened

LiteLLM is an open-source LLM proxy that puts one OpenAI-compatible API in front of 100+ model providers, with load balancing, cost tracking, rate limiting, and guardrails. Guardrails are the filters that check prompts and responses on the way through.

One guardrail type lets you write your own filter logic in Python-like code that “runs in a sandboxed environment”, with no imports, no file I/O, and no exec() or eval(). To try a filter before you save it, the proxy exposes a test endpoint: POST /guardrails/test_custom_code.

That sandbox didn’t hold. According to LiteLLM’s security advisory, the endpoint ran user-supplied Python inside a “hand-rolled sandbox” that could be escaped with bytecode-level tricks, giving arbitrary code execution in the proxy process, which runs as root in the default Docker image.

The researchers at X41 D-Sec, who are credited with the find (Markus Vervier), published the full chain. The short version: the sandbox blocked dangerous names with regex filtering on the source code. So the exploit builds those names at runtime with string concatenation, rewrites a generator’s bytecode to reach attributes the filter never saw, and pulls the real __import__ out of one of the helper functions the sandbox hands you on purpose. A regex can’t see a string that doesn’t exist yet.

Who’s affected

The timeline matters. The CVE was published to NVD in April 2026, and GitHub’s reviewed advisory went up May 11. The KEV listing came November 18. Seven months of “we’ll get to it” is exactly the window attackers live in.

What CISA’s listing does and doesn’t say

CISA gave federal civilian agencies until December 2, 2026 to apply the vendor’s mitigations or stop using the product. Under Binding Operational Directive 26-04, that deadline is binding only on those agencies. CISA encourages everyone else to prioritize KEV bugs too.

What the entry doesn’t tell you: who’s exploiting it, how they’re getting the admin credential, or how many systems were hit. CISA lists known ransomware use as “Unknown”. We haven’t found a primary source with exploitation details. Anything you read beyond that is a guess, and we’re not going to make one here.

The stopgap if you can’t upgrade today: LiteLLM’s advisory says to block POST /guardrails/test_custom_code at your reverse proxy or API gateway.

What this means for San Antonio builders

This section is our opinion and analysis, not reporting.

A lot of the agent work happening around town runs through a gateway like this. If you were building at Agent Builders Night this month, there’s a decent chance LiteLLM or something like it sits between your agent and your API keys. That makes it one of the most valuable boxes you run, whether it feels like “infrastructure” or not.

Here’s the 20-minute version before you leave for Thanksgiving:

  1. Find every copy. Run pip show litellm in each environment, check the image tags on your proxy containers, and look for LiteLLM bundled inside other tools. Side projects count. That forgotten demo on a $5 VPS counts double.
  2. Upgrade to 1.83.11 or later. If you can’t, block the test endpoint at the edge today.
  3. Block it anyway. If nobody on your team writes custom-code guardrails, there’s no reason for that endpoint to be reachable from outside. Defense in depth is cheap here.
  4. Treat the admin key like a root password. Exploitation needs a proxy-admin credential in default setups. If that key has lived in a .env file in a repo, a shared doc, or a Slack thread, rotate it. If an unpatched proxy was reachable from the internet, we’d also rotate the provider API keys it holds. That’s cheaper than finding out.
  5. Stop running it as root. LiteLLM publishes a non-root image, and its production docs show a LITELLM_NON_ROOT setting. Root wasn’t the bug, but it’s why the bug hurts this much.
  6. Keep the admin UI off the public internet. Put it behind a VPN or an identity-aware proxy. Your users need the API. They don’t need the admin panel.

The bigger lesson isn’t about LiteLLM. Guardrails are code, and code has bugs. A safety feature that executes user-supplied logic is an attack surface first and a safety feature second. And “sandbox” built from a regex is a suggestion, not a wall. If you’re building agent tooling that runs code from users or from models, use real isolation (a separate process, container, or VM with no secrets in it), not string filtering.

San Antonio has spent years calling itself Cyber City. The AI tooling we’re all wiring together is where that reputation gets tested next. If you build for federal civilian customers, assume they’ll ask about that December 2 date.

Talk about it in person

Three December meetups in town are good places to compare notes. Byte Night is ours; the other two are run by other groups, so check their pages for the latest.

  • Geeks&&Drinks: San Antonio, hosted by the Geeks&& Community. Tuesday, December 1, 6–8 PM CT, at Idle Beer Hall & Brewery, 414 Brooklyn Ave. Bring your patch story.
  • Confidential Computing Leveraging Bootable Containers || General Meeting, from ACM San Antonio. Wednesday, December 9, 6–8 PM CT, hybrid. The Meetup page says the venue and speaker details are still to be announced: venue [TBD]. If “how do I isolate the thing that runs untrusted code” is on your mind after this week, the topic is right on point.
  • Byte Night, hosted by Alamo Tech Collective. Friday, December 11, 6 PM CT, at Zelifcam, 10200 San Pedro Ave. Laid-back, no pitches: bring a laptop and your patch-and-rotate war stories, or just come talk shop.

Pitch us a talk

Got a LiteLLM setup you’d defend, a sandbox you’ve broken, or a war story about rotating keys at 2 AM? That’s a talk. Our events come from the community, not from sponsors. Pitch it through our Meetup group or grab one of us at an event.

Patch first. Then pie.


Alamo Tech Collective Building San Antonio’s tech community, one event at a time.

Sources