LiteLLM was poisoned twice this year. Here's the order we'd rotate your AI keys in
A poisoned LiteLLM release and four exploited LiteLLM flaws all lead to the same place: the proxy that holds every model-provider key. Here's how the October attack worked, what to patch and the order to rotate keys in.
part 68 of 70 · Platform releases, explained from scratchthe ideaA key nobody revoked led to a bad release. Rotate from a clean host.
after reading, you can- Work out whether any LiteLLM proxy you run is exposed to the October release or the four KEV flaws
- Rotate a compromised gateway's keys in an order that doesn't hand the new ones to the attacker
- Set up the gateway so the next leak costs one team's key, not the whole company's
A poisoned LiteLLM release reached PyPI and Docker Hub on October 21, and four LiteLLM flaws have landed on CISA's exploited list this year. If you run a LiteLLM proxy, treat it as the place where every model-provider key you own sits together, patch it to a current release, and know the order you'd rotate those keys in before you ever need it.
Your AI gateway keeps the keys to every model you pay for. If it's breached, they all go at once.
Lots of companies put a small server between their apps and AI providers such as OpenAI or Anthropic. LiteLLM is a popular open-source one. Apps get a gateway key, and the gateway holds the real provider keys, tracks spend and applies limits. That's tidy until someone else gets onto the gateway. In October a fake LiteLLM version went out through LiteLLM's own release channel for about two hours, and it stole credentials from any machine that ran it. Separately, attackers have used four LiteLLM bugs this year, and one of them was added to CISA's list on November 18. Either way, the fix is the same: patch, then swap out every key the gateway could reach, starting with the ones that cost the most to lose.
Think of a hotel key cabinet behind the front desk. Guests never touch the master keys, which is the point. But whoever opens that cabinet doesn't get one room, they get every room, and changing one lock at a time while they're still behind the desk doesn't help.
- Teams running a LiteLLM proxy
- Platform and DevOps engineers
- Security and incident response
- Anyone paying for OpenAI or Anthropic APIs
- Owners of AI pilots on shared servers
Why it matters to you
A stolen provider key is someone else running up your AI bill, and possibly reading whatever your apps sent through it. A stolen gateway goes further. LiteLLM's own advice after the October release was to rotate every provider key in the proxy database, the master key, the virtual keys, the database password, the server's cloud role and anything else in its environment. That's a long list for a box many teams set up in an afternoon for a pilot.
The supply-chain attack and the CVEs are separate problems with the same prize. The SQL injection CISA listed in May let someone with no login read the proxy's database, and the LiteLLM advisory says that can lead to the credentials it manages. The poisoned release ran the next time Python started. The newest KEVdefinitionCISA's list of flaws that attackers are actually using. Federal agencies get a due date for each, and most security teams watch it too. entry needs an admin credential, and LiteLLM's advisory notes that the proxy runs as root in the default Docker image, so a stolen master key turns into root inside the proxy container.
There's a lesson from LiteLLM's own write-up that applies to everyone. The attack started with an admin key that was committed to a public repository and deleted about three hours later. Nobody revoked it. Deleting a leaked secret from a file doesn't stop it working. Four months on, it still opened the service that held an owner's GitHub token.
How one forgotten key ended up on your servers
-
01 An admin key leaks and is left live
A config file with an admin key for an internal LiteLLM service went into a public repo. The file was deleted hours later, but the key was never revoked.
-
02 That service holds an owner's token
One API call with that key returned an organisation owner's GitHub CLI token. LiteLLM says those tokens aren't scoped to repositories, so the attacker could act as the owner.
-
03 CI is turned into an exfiltration tool
Throwaway branches ran workflows that posted repository secrets to an outside endpoint, including two more maintainers' tokens.
-
04 The real pipeline builds a fake release
The owner token let them push past branch protection and point the release workflow at a lookalike repo. Then a second stolen token approved the release.
-
05 Your server installs it and is robbed
Anyone who installed litellm 1.107.0, or pulled one of four Docker tags in any image variant during the Oct 21 window, got malware. It ran every time Python started and went after the credentials on that machine.
For engineers: the malware didn't need anyone to import LiteLLM. LiteLLM's notes name cook.pth and sitecustomize.py in site-packages, both of which Python loads at startup, plus a detached daemon holding /tmp/remote_code_loader.lock. So running pip on an infected host to check the version runs the payload again. GitGuardian, citing Microsoft's analysis, reports that it also queried the LiteLLM proxy database where upstream provider keys live.
# example output. Run these from a shell, never through python or pip on the suspect host $ find / -name 'litellm-1.107.0.dist-info' -o -name 'cook.pth' -o -name 'sitecustomize.py' 2>/dev/null # plain shell, no Python /opt/app/venv/lib/python3.12/site-packages/cook.pth # a hit. This host ran the bad build, so stop here and rebuild it $ ls -l /tmp/remote_code_loader.lock # a hit on any of these confirms exposure. No hit proves nothing: containers and tmp cleanup remove them $ docker image ls --digests | grep -i litellm # bad digests LiteLLM lists: 1bbcb1443bc9 (litellm), c00f9d92c427 (litellm-database), 7b00e91cd2fe (litellm-non_root). A match means the host is lost
What LiteLLM fixed, and what's still on you
The fixes and changes that matter to operators
PyPI quarantined the wheels and LiteLLM removed or repointed the Docker Hub and GHCR tags. LiteLLM says the official 1.107.0 source tag never had the malicious files.
The old cosign key was replaced after it was likely exposed. The bad 1.107.0 images still carry a valid signature from that old key, so check digests too. From v1.111.0-dev.3, releases use keyless signing.
The guardrail test endpoint ran user Python in a home-made sandbox that could be escaped. The advisory's text says 1.83.11 or later, though its version field says 1.83.10. Go with 1.83.11.
A fallback path let a made-up Authorization header open an MCP session and call connected tools. Fixed in 1.84.0.
Any valid key, even a low-privilege one, could make the proxy spawn a command on the host. Fixed in 1.83.7 by requiring the admin role.
A crafted Authorization header with no valid key could reach a database query and read the proxy's data. Fixed in 1.83.7.
Nobody's everyday GitHub account is an owner any more, and owner accounts can't use tokens or the gh CLI. Moving automations off personal tokens is still in progress.
None of those fixes touch your keys. If a poisoned build ran on your server, or someone got in through one of the CVEs before you patched, the stolen keys still work until you replace them at the provider. Patching closes the door. Rotation is how you change the locks.
| CVE | What it lets someone do | Login needed? | Fixed in | Added to KEV |
|---|---|---|---|---|
| CVE-2026-42208 | Read the proxy database, and possibly change it, through key checks | No | 1.83.7 | May 8, 2026 |
| CVE-2026-42271 | Run commands on the host through MCP test endpoints | Any valid key | 1.83.7 | Jun 8, 2026 |
| CVE-2026-59822 | Open an MCP session with a made-up bearer token | No | 1.84.0 | Sep 2, 2026 |
| CVE-2026-40217 | Run code in the proxy through the guardrail test endpoint | Admin by default | 1.83.11 | Nov 18, 2026 |
How the year went for LiteLLM operators
- Mar 24, 2026litellm 1.82.7 and 1.82.8 poisoned
Live on PyPI for about 40 minutes. LiteLLM traced it to an unpinned Trivy scanner in its CI that read static release credentials.
- May 8, 2026SQL injection joins KEV
CVE-2026-42208. Nobody needs a login for this one, and it reaches the database where your provider credentials sit.
- May 27, 2026Admin key committed to a public repo
Deleted about three hours later. Never revoked.
- Jun 8, 2026MCP command injection joins KEV
CVE-2026-42271. Hand someone even a low-privilege key and they could run commands on the host.
- Sep 2, 2026MCP auth bypass joins KEV
CVE-2026-59822. Fixed in 1.84.0.
- Oct 10, 2026The old key is used
Someone finally uses the forgotten key. They get an owner's GitHub token, then steal two more through throwaway CI runs.
- Oct 21, 2026Poisoned 1.107.0 published
The PyPI wheels were up from 11:39 to 13:23 UTC and Docker Hub tags until 14:20 UTC. Anything that installed or restarted in that window is suspect.
- Oct 30, 2026LiteLLM publishes its changes
Owner accounts split out at once. Ticketed key revocation and moving automations off personal tokens are still on its to-do list.
- Nov 18, 2026Guardrail sandbox escape joins KEV
CVE-2026-40217. Federal agencies have until December 2, and everyone else should read that as this week.
What to do now
What to do now, by who you are
- Ask your team or provider: do we run LiteLLM anywhere, including pilots and developer laptops?
- Ask which version, and whether anything installed litellm 1.107.0 or pulled v1.107.0, latest, main-latest or main-stable on Oct 21.
- Ask for a list of the AI provider accounts the gateway can spend from, and who owns each one.
- Check last month's AI provider invoices for spend nobody can explain.
- Get every proxy onto a release at or past 1.84.0, skipping the pulled 1.107.0. That one upgrade covers all four KEV fixes.
- Until then, block POST /guardrails/test_custom_code, /mcp/ and the /mcp-rest/test endpoints at your reverse proxy. The /mcp/ flaw needs no login at all.
- Pin images by digest and stop deploying latest, main-latest or main-stable. Those floating tags are how the bad build reached people on a routine restart.
- Verify image signatures with the method LiteLLM gives for each release. The bad 1.107.0 images carry a valid old signature, so check digests too.
- Search build logs and lockfiles for 1.107.0, 1.82.7 and 1.82.8. Some apps pull LiteLLM in through another package, so look there too.
- Write down every provider key each proxy holds and every secret in its environment. You can't rotate what nobody listed.
- Check CloudTrail for GetCallerIdentity from the instance role around install time, then for that role used from outside your network.
- Pull provider usage logs for the gateway's keys and look for calls from addresses you don't own.
- Treat any host that ran a poisoned build as compromised, even if you can't find the marker files.
- Pin litellm to an exact version in every requirements file and lockfile. An open range is how a fresh build picks up a bad release.
- Stop putting provider keys in .env files on laptops. Use a gateway virtual key instead.
- Assume coding agents on your laptop can read your GitHub CLI token. LiteLLM now sizes accounts on that basis, and so should you.
Harden the gateway so the next one hurts less
The gateway is a secrets store with an HTTP API in front of it. Run it like one. The changes below come from LiteLLM's own production docs, its post-incident list and HashiCorp's Vault docs, applied to a gateway.
Before: one proxy, long-lived keys, open admin API
The usual pilot setup. Provider keys sit in Postgres, the salt key and cloud role sit on the same host, and the admin console faces the same network as the apps.
After: pinned proxy, short-lived cloud access, fenced admin
The proxy is pinned by digest and runs as non-root. The admin API is only reachable through an identity-aware proxy. Vault issues short-lived database and AWS credentials. Provider keys are split per team so one leak has a smaller blast radius.
Hardening, in the order we'd do it
- 01Pin and verify every release
LiteLLM's production guide says to pin a version and not use latest, verify the image signature, and deploy an immutable digest. Do the same for the Python package with an exact version and a hash in the lockfile.
- 02Fence the admin surface
The master key logs into the admin console and calls every admin API. Put that console behind an identity-aware proxy or VPN, and block the test and guardrail endpoints you don't use at the reverse proxy.
- 03Take root away
The CVE-2026-40217 advisory points out the default image runs the proxy as root. LiteLLM ships a non-root image. Use it, and drop cloud permissions the proxy doesn't need.
- 04Split provider keys by team or app
One provider key for the whole company means one rotation that breaks everything. A key per team or per environment lets you revoke one without taking production down.
- 05Move what you can to short-lived credentials
Vault's database secrets engine issues per-service database logins with a lease, and its AWS engine issues IAM credentials that are revoked when the lease ends. Neither helps with a static OpenAI key, so keep those in a secret manager and rotate them on a schedule.
- 06Make revocation a ticket
LiteLLM has committed to this one: a leaked-secret alert opens a ticket, and the ticket closes only when revocation is confirmed. Copy that. Deletion from git is a cleanup step, never the fix.
- 07Slow down new packages
Commenters on Hacker News suggest a cooldown on new package versions. One proposes 24 to 48 hours, another runs a week behind an internal mirror and notes it also holds back security fixes, so keep a fast lane for those.
- Runs the latest tag, so a restart can pull a new build nobody checked
- Every app shares one OpenAI key, so rotating it breaks them all
- Master key sits in a .env file and hasn't changed since launch
- Admin console reachable from the office network
- Nobody has a list of what's in the proxy's environment
- Image pinned by digest and signature checked in the pipeline
- Provider keys split by team, and someone owns each one
- Master key in a secret manager, rotation tested once a quarter
- Admin console only behind an identity-aware proxy
- A written rotation order that someone has actually walked through once
If a poisoned build ran, or you think someone got in
Rotate in this order, and do it from a clean laptop
Work from a clean machine the whole time. Every secret you type on an infected host goes straight to the attacker, so rebuild first and rotate from somewhere they've never been.
- 01Containfirst hour
- Stop the proxy and cut its outbound internet access, but keep the disk.
- Don't run python or pip on the host. LiteLLM says any Python start reruns the payload.
- Snapshot the disk or container and copy the proxy logs and Postgres data somewhere safe.
- Call the owners of the apps behind the gateway. Their AI features will be down for a while, and they'll ask why.
- 02Cloud access firstfirst hours
- Rotate the instance or task role and any cloud keys found in the host's environment.
- In CloudTrail, look for GetCallerIdentity from that role near install time, then calls from outside your network.
- Revoke any Vault tokens or leases the host held. IAM-user keys go at once, but STS credentials may stay valid until their TTL runs out.
- 03Provider keysfirst day
- Make a new key at each AI provider and load it into the new gateway. Then delete the old key, so the stolen copy stops working.
- Pull each provider's usage for the old keys and note any calls you can't match to your apps.
- Do this for every key stored in the proxy database, not only the ones you think were used.
- 04Rebuild the gatewayfirst day
- Deploy a pinned, verified release on a fresh host with a new database password and a new salt key.
- Set a new master key. Re-add models with the new provider keys rather than restoring the old database.
- Issue new virtual keys to each app, with no grace period on the old ones.
- 05Everything elsefirst week
- Rotate GitHub, CI, Slack and other tokens that were in the host's environment or .env files.
- Hunt for the same build on CI runners and laptops. Anywhere Python started with it counts.
- Ask legal whether prompts or data that passed through the gateway trigger customer or regulator notice.
- Write down which keys took longest to rotate and fix that before the next one.
Three typical setups
- the setup
- A product team set up the LiteLLM proxy for a chatbot pilot. It runs the latest Docker tag on a VM that also hosts other tools, and one OpenAI key sits in its database.
- what happens
- The container restarted on Oct 21 and pulled the poisoned image. The VM's cloud role, the OpenAI key and a GitHub token in a .env file are all readable by the payload.
- what to do
- Treat the VM as lost. Rotate the cloud role and GitHub token first, then the OpenAI key. Rebuild on a pinned digest and give the gateway its own host.
- the setup
- A mid-size company runs LiteLLM for several teams, pinned to a release from spring. The admin console is reachable on the corporate network, and there's one master key.
- what happens
- They never pulled 1.107.0, but they ran a version open to the May SQL injection for months. Nobody can say whether the provider keys in Postgres were read.
- what to do
- Upgrade to a current release past 1.84.0 this week. Because the database may have been read, rotate every stored provider key. Then fence the console.
- the setup
- A large firm runs the proxy pinned by digest, pulls provider keys from HashiCorp Vault through AppRole, and gets its database login from Vault's database engine.
- what happens
- Their pin kept 1.107.0 out. The KEV entries still apply, and the guardrail endpoint is reachable to anyone holding the master key.
- what to do
- Patch, block the guardrail test endpoint until done, and rehearse revoking the gateway's Vault leases so a real incident takes minutes.
How Cohash helps
We treat AI gateways as part of secrets management. That means finding every proxy and the keys it holds, moving those keys into HashiCorp Vault or your cloud's secret manager, and writing a rotation order your team has rehearsed once. If you need engineers to do the rotation now, see Vault engineers for hire, our secrets and certificate management practice, or start with an assessment.
What to take from this
- 01
Get every LiteLLM proxy to a current release at or past 1.84.0. That covers all four KEV entries.
- 02
If anything ran litellm 1.107.0, 1.82.7 or 1.82.8, rebuild the host and rotate everything it held. Uninstalling isn't enough.
- 03
Rotate from a clean machine: cloud access first, then provider keys, then the gateway's own keys.
- 04
A leaked secret is fixed when it's revoked. Deleting the file or the commit doesn't count.
- 05
Pin by digest, split provider keys by team, and keep the admin console off the open network.
- How Cohash delivers HashiCorp Vault: scope, roles and architecture
- How Cohash delivers OpenAI API: scope, roles and architecture
- How Cohash delivers Anthropic Claude: scope, roles and architecture
- Hire vetted HashiCorp Vault engineers
- Secrets and certificate management
- Book a 30-minute working session with a senior engineer
01Am I affected by the LiteLLM 1.107.0 compromise?
Assume yes if you installed litellm 1.107.0 from PyPI. The same goes if you started the v1.107.0, latest, main-latest or main-stable images while they pointed at the bad build on October 21. LiteLLM says its private enterprise registry wasn't hit.
02Is uninstalling LiteLLM enough?
No. The malware left startup files in site-packages that Python loads on every start, so they can outlive the package. Rebuild the environment from a trusted image or a fresh virtual environment, then rotate credentials from a different machine.
03Which LiteLLM version should I run now?
Anything at or past 1.84.0, other than the pulled 1.107.0, has all four KEV fixes. Pin it by exact version or image digest so it can't drift, and check its signature the way LiteLLM says for that release.
04What should I rotate first?
Anything that reaches beyond the gateway: the server's cloud role and any cloud or GitHub tokens in its environment. Then the AI provider keys stored in the proxy. Then the gateway's own database password, salt key, master key and virtual keys on a rebuilt host.
05Can I just rotate the LiteLLM salt key?
LiteLLM's docs say there's no in-place migration for the salt key, and changing it makes stored credentials unreadable. If the host was compromised, stand up a fresh database with a new salt key and re-add models with new provider keys.
06Does HashiCorp Vault stop this kind of attack?
It doesn't stop code running on the gateway. It does shrink what's left afterwards. Vault's database and AWS engines issue short-lived credentials that expire on their own, and revoking a lease kills many of them straight away. Keeping provider keys in Vault gives you one place to rotate from.
07We're not a federal agency. Does CISA's December 2 date matter to us?
The date binds US federal agencies. For everyone else, a KEV listing means there's evidence of real attacks, so it's a good reason to patch that week.
Three questions, about a minute
Pick an answer and we'll tell you if it's right, and why it is or isn't. The score stays in this browser.
-
Q1Your pilot gateway pulled the latest tag on Oct 21, and you can't find cook.pth anywhere. Now what?
show the answer
C. Treat the host as compromised and rebuild it LiteLLM says a missing marker proves nothing because containers and tmp cleanup remove it, and running pip on the host reruns the payload. Rebuild, then rotate from a clean machine.
-
Q2You're regenerating an app's virtual key mid-incident. Which setting do you leave empty?
show the answer
A. grace_period A grace period in LiteLLM's Enterprise key rotation keeps the old key working alongside the new one. That's fine for routine rotation, but in an incident it leaves the stolen key live.
-
Q3A leaked key was deleted from the repo three hours after the commit. What else had to happen?
show the answer
D. Revoke the key at the service that issued it In LiteLLM's case the deleted key stayed valid for four months and opened the door. Only revocation stops a leaked secret from working.