Latest

Cybersecurity

LiteLLM 1.107.0 poisoned: it stole keys on Python startup

LiteLLM 1.107.0 spent two hours on PyPI and almost three in the official Docker images with a credential stealer that activated on Python startup.

LiteLLM 1.107.0 poisoned: it stole keys on Python startup
LiteLLM 1.107.0 poisoned: it stole keys on Python startup

Version 1.107.0 of LiteLLM spent less than two hours on PyPI, between 11:39 and 13:23 UTC on October 21, 2026, and in that window seven wheels were published with a credential stealer inside. The damage did not stay on the Python index: the official Docker Hub and GHCR images kept serving the same artifact almost three hours after its publication.

What sets this incident apart from ordinary malware is the trigger. The attackers added three files that Python executes when initializing the interpreter, so no application needed to import LiteLLM to be exposed. Simply starting Python in an environment where the version was installed was enough, and that includes anyone who opens a terminal and runs pip to check whether they have the problem. Microsoft documented a case on Windows where a routine installation of another dependency activated the collector.

LiteLLM is the piece many companies place in front of OpenAI, Anthropic or Bedrock to unify access to models, and that position leaves it holding the keys of all providers at once. Whoever compromises it does not steal a single account, they steal the gateway to an entire customer's AI billing.

A two-hour window and seven contaminated wheels

The malicious package reached the public index at 11:39:51 UTC and by 13:23 it was gone, according to the project's own timeline. They were seven wheels for macOS, Linux and Windows, so no combination of system and architecture was safe by chance.

Container tags were the worst part. Docker Hub kept `v1.107.0`, `latest`, `main-latest` and `main-stable` pointing to the compromised index until 14:20 UTC, and GitHub Container Registry took almost two hours to remove its own.

Artifact October 21 window, in UTC Final status
PyPI, litellm 1.107.0 (seven wheels) 11:39 to 13:23 Removed from the index
Docker Hub, four moving tags 11:46 to 14:20 Removed or repointed
GHCR, the same four tags 11:46 to 13:51 Unavailable
Source code tag on GitHub Unchanged Never carried the payload

The last row explains why the sabotage took time to detect. The version tag and the tarball were clean: the poisoning lived in the built artifact, not in the code anyone reads on GitHub.

Python startup as the gateway

The first mechanism is `cook.pth`, a two-word file whose entire content is `import cook`. The `site` module goes through the `.pth` files of each environment at interpreter startup and executes the lines that begin with `import`, a feature intended for registering paths that here served as a launcher. The result is that `cook.py` ran every time, regardless of what the application did.

`cook.py` decodes in Base64, decompresses with zlib and hands the result to `exec()`. JFrog decrypted the content without executing it and obtained about 61 KB identified as `privcollect`. The program starts a daemon thread, sets `PRIVCOLLECT_ACTIVE` to avoid repeating itself in child processes and only leaves the marker `/tmp/.pc_once_72129118c59f5636c0bb` when the upload returns a 200.

The second hook is `sitecustomize.py`, which Python tries to import on its own after processing the paths. This one adds remote code loading: it takes a lock in `/tmp/remote_code_loader.lock`, detaches from the parent process and requests `/codepy` from the server indicated by a file hosted on GitHub, in order to compile and execute it. Microsoft did not confirm any second-stage download, because the pointer was empty, but the mechanism reactivates by changing that file.

On Windows that path fails, because the code depends on `os.fork()`. The collector does not, since `cook.pth` runs anyway, and that asymmetry leaves Windows workstations exposed even if the loader never starts.

What did the collector take?

The inventory reconstructed by Microsoft and JFrog describes the target: development environments, continuous integration agents and AI gateways in production. The payload goes through modules that handle their errors separately, so a failure in one target does not stop the rest.

  • SSH, GPG keys and TLS certificates of the user running the process
  • AWS, Azure and Google Cloud credentials, with instance and Kubernetes metadata
  • Secrets from GitLab Runner, Jenkins, Vault, Terraform and Packer
  • Password databases and history from Chromium and Firefox browsers
  • Tokens from AI tools such as Cursor, Claude Code or Copilot
  • Its own environment variables and those of any readable `/proc/<pid>/environ`
  • The `LiteLLM_CredentialsTable` and `LiteLLM_ProxyModelTable` tables, with 500 rows per query

The last entry is the most painful for a company. A LiteLLM gateway often stores the keys of all the organization's model providers, so a single compromised host hands over access to the entire AI billing. The set travels encrypted with AES-256-CBC and the key wrapped with a 4,096-bit RSA toward `www.litellm.dev/healthcheck`, a domain registered on October 13, 2026 that imitates the official `litellm.ai`.

From the GitHub token to the signed package

None of this would have happened without a key that was never rotated. On May 27, 2026 someone uploaded to a public repository an `opencode.json` with the master key of the project's internal agent platform. The mistake was corrected, but the revocation was left pending. On October 10, from `69.48.229.143`, the attacker used it to obtain the GitHub CLI OAuth token of one of the organization's two owners.

With that identity came the disposable branches. `ci-tmp-a351cc` in `BerriAI/litellm` published six continuous integration secrets to a webhook.site endpoint, among them `GH_TOKEN`, the token of a second maintainer. Twenty-four seconds later it was the turn of `ci-tmp-be33e9` in `BerriAI/litellm-auto`, which sent `RELEASE_PLEASE_TOKEN` and with it the credential of a third party.

On October 21 the final move was a change of origin: the attacker forced the publication flow to build from the clone `Berri-AI/litellm`, at commit `20535d8f`, and approved the production gate with the second maintainer's token.

The legitimate pipeline signed and published the poisoned artifact. The project acknowledges in its root cause analysis that the two-signature restriction had been relaxed that week and that an owner token could have disabled it. Reviewing the code or the Git tag would have shown nothing: the malware only existed in the built wheel.

What to rotate and in what order?

The first step is counterintuitive and that is why it is worth writing down: do not open pip in the suspicious environment. Any Python startup runs the hooks again, so checking with `pip show litellm` can trigger the theft you were trying to avoid.

  1. Delete `cook.pth`, `cook.py`, `sitecustomize.py` and the `__pycache__/cook.pyc` and `sitecustomize.pyc` files from every affected `site-packages`.
  2. Kill the daemon holding `/tmp/remote_code_loader.lock` and check for the `.pc_e_` and `.pc_sq_` traces.
  3. Rebuild the environment from scratch with `litellm==1.106.2` instead of deleting the library directory.
  4. From a clean machine, rotate the provider keys, the proxy keys, the `DATABASE_URL` password and the IAM role.
  5. Search CloudTrail for calls to `GetCallerIdentity` around the installation time and their later use from outside your network.

The absence of the marker in `/tmp` proves nothing. It only appears when the exfiltration returned a 200, and containers are wiped on restart. LiteLLM sums it up in its notice: if the version was installed on a host with internet access, assume the upload went out.

The official container does not save you either

For years the advice was to distrust packages and trust the official image. Here both routes were compromised, with the same index `sha256:1bbcb1443bc9…` on Docker Hub and on GHCR. The lesson lies in how a dependency is pinned: `latest` points to whatever the registry wants to serve, a digest points to immutable content. Microsoft adds checking pip and uv caches, internal mirrors and lock files, where an already withdrawn version survives.

The case fits the dependency quarantine that other ecosystems already treat as a basic control, as was raised with the Cargo quarantine that arrived with Rust 1.100. A delay of hours would have put this window out of reach for almost any team.

A pattern now on its second run this year

JFrog documented in March 2026 the first hijacking of LiteLLM, with versions 1.82.7 and 1.82.8 published through an unpinned version of Trivy, 0.69.4, which exposed CI/CD credentials. That episode was attributed to the TeamPCP group and distributed backdoors through Kubernetes nodes. The current one uses other startup files and other infrastructure, and no link has been found between the two.

The uncomfortable coincidence is the underlying pattern. Two compromises of the same package in seven months, both with theft of developer credentials and a pipeline that signed without protest. The AI stack is deployed with the habits of 2015: moving tag, eternal token, secret in a `.env` and nobody looking at the wheel's `RECORD`.

Anyone running LiteLLM in production can check today whether their digest matches the compromised one, whether any `site-packages` holds a `cook.pth` and whether their keys have remained the same since October 21. All three answers fit in twenty minutes and weigh more than any patch this week.

José Maldonado

Author

José Maldonado

Activist and blogger on technology, free software and blockchain.

The latest
From Huang to Botín, from Zara to Byron: corporate responsibility in global capitalism

Keep reading