Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor
- Source
- safedep.io
- Publisher
- SafeDep
- Author
- abhisek
- Date
SafeDep analyzed LiteLLM 1.107.0 as published on PyPI and found a release that installs three files into site-packages. Those files run a credential stealer and a remote-code backdoor every time Python starts on the machine, so the implant runs whether or not the program in question uses LiteLLM. The writeup covers how the malicious code got into the release, what the payloads do, a timeline and indicators of compromise. LiteLLM sits between applications and many model providers, which means the environments that install it tend to hold exactly the API keys a stealer wants. The listed files and indicators let teams check whether a machine ran the release, and any secret such a machine could read has to be treated as exposed. Paired with Railway's disclosure the same day, it puts stored AI provider keys at the center of two separate attacks in one news cycle, one through a hosting platform and one through a package registry.

Context
LiteLLM is a Python library and proxy that puts many model providers behind one API. According to SafeDep's analysis, the litellm 1.107.0 release uploaded to PyPI on October 21 carried a credential stealer and a remote code execution backdoor, installed by all seven of its wheels for Linux, macOS and Windows, and PyPI has since removed it. SafeDep says versions 1.106.2, 1.107.0rc1 and 1.107.0rc2 are clean, as are the companion packages 1.107.0 pins, litellm-proxy-extras 0.4.110 and litellm-enterprise 0.1.78.
The dangerous part is how it ran. The release added a .pth file, a kind of file whose import lines Python runs automatically at startup, so the stealer ran in every Python process on the host, including pip, IDE language servers and CI jobs, not only code that imported litellm. A sitecustomize.py file, also loaded at startup, launched a background daemon that every hour read a server address from a file in an attacker's GitHub repository, ran the stealer again and downloaded and executed code from that server. SafeDep says the stealer collected SSH keys, AWS, Azure, gcloud, Kubernetes and Docker credentials, CI/CD secrets, AI coding tool tokens, saved browser passwords, environment variables, AWS instance role credentials, GPG and TLS private keys, and the provider API keys stored in a LiteLLM proxy database. It encrypted the results and posted them to a litellm-named .dev domain that SafeDep lists as the collection server. By 13:40 UTC, about two hours after the release, the GitHub account and repository the backdoor relied on returned 404, so the backdoor now finds no server. Hosts that ran the daemon before then could have received and run second-stage code, and SafeDep could not recover the server address involved.
The malicious files were not in the public GitHub source. SafeDep traced them to one extra line in the packaging config of the published source archive, which copies a cook into every wheel, and found no public commit in BerriAI/litellm containing that line or folder. The same edit set the version back to 1.107.0 and pinned the companion packages to the rc2 values, so a comparison against rc2 shows nothing unusual. Because the wheels match the output of the normal release tooling and no public GitHub Actions run built them, SafeDep assesses with moderate to high confidence that BerriAI's private release pipeline built them from attacker-modified source. It says a compromised maintainer or bot credential, a private branch or mirror, or the reference the pipeline builds from could explain that, and that only BerriAI's pipeline logs can confirm the cause.
SafeDep's timeline puts the upload at 11:39 to 11:40 UTC and records the release as observed gone from PyPI at 13:40 UTC; it gives no download count. It does not give remediation steps, but it lists indicators to check: cook.pth, cook.py and sitecustomize.py files in site-packages, a /tmp/.pc_once marker file that means the stealer already uploaded data, a /tmp/remote_code_loader.lock file that means the backdoor daemon ran, the PRIVCOLLECT_ACTIVE environment variable, and outbound requests to the collection server. Given what the stealer targeted, a reasonable inference, though not one SafeDep states, is that any reachable from a machine that ran 1.107.0 should be treated as exposed.
- Large language model — A model trained on large amounts of data to process and generate language.
- Folder — A named container that holds files and other folders; also called a directory.
- Dependency — Anything a program needs to run that its author did not write: the language, its standard library, or a separately installed package.
- Secret — A value such as a password, key or token that lets its holder act as someone; it must be kept out of code and shared files.
