HomeTech NewsCybersecurityMalicious LiteLLM Release on PyPI Stole Credentials, Researchers Say

Malicious LiteLLM Release on PyPI Stole Credentials, Researchers Say

Updated 30 October 2026: LiteLLM has resumed releases since the incident. PyPI listed 1.106.6, uploaded on 28 October, as the latest version on 30 October, and on 27 October the project published patched versions 1.103.10, 1.104.8, 1.105.6 and 1.106.5 for a separate vulnerability (GHSA-w4c7-34wj-hqm8) after a private-registry embargo. The line on the PyPI listing below has been corrected to reflect that 1.106.2 was the latest version at the time.

Update, 24 October 2026: LiteLLM has published a root-cause report tracing the compromise to a master key that leaked in May and was never revoked. It says some of its earlier status updates were inaccurate or incomplete, and this story has been corrected. The full chain is set out in “A key leaked in May and never revoked opened the way, LiteLLM says” below.

For roughly two hours on Wednesday, by SafeDep’s timeline, installing the latest version of LiteLLM from PyPI meant installing malware too.

LiteLLM is an open-source library, with more than 61,000 stars on GitHub, that in its own words lets developers call more than 100 large language model APIs in a single format. Version 1.107.0, uploaded to the Python Package Index at about 12:40 BST on 21 October, “carries a credential stealer and a remote code execution backdoor”, security firm SafeDep says. Its maintainers confirmed the compromise on the GitHub issue where it was first reported. “We are actively investigating and treating this as SEV-0. PyPI quarantined 1.107.0,” a LiteLLM contributor wrote at 14:50 BST.

PyPI has removed the release; at the time, its listing showed 1.106.2 as the latest version. The maintainers say the malicious Docker images have also been taken down.

TSN tracks attacks like this on its ransomware and cyber attacks hub.

The maintainers pulled the malicious 1.107.0 release within hours, but the fuller picture of how it worked arrived two days later.

Update, 23 October 2026: Microsoft has published a technical breakdown of the compromise.

Microsoft says the payload ran from Python’s startup hooks, before any import

In analysis posted on 23 October, Microsoft Security said the booby-trapped 1.107.0 package planted two hidden startup hooks – a cook.pth file and a sitecustomize.py – inside the package’s data directory, so a Base64- and zlib-encoded collector fired in a background thread the moment Python launched. “An application did not need to import LiteLLM for the payload to run: starting Python in an affected environment could be enough,” the company wrote. The collector swept developer, cloud and source-control credentials, browser data, SSH, GPG and TLS keys and the LiteLLM proxy database, encrypted the haul with AES-256 under an RSA-wrapped key, and posted it to www.litellm.dev. A separate Unix loader fetched a GitHub-hosted drop domain to pull further code; Microsoft described it as “a re-armable remote-code execution mechanism” but said it could not confirm that stage ran. Crucially, Microsoft added that it “has not independently determined how the attacker first accessed the upstream environment” – leaving the maintainers’ account of stolen developer credentials as their own, unconfirmed by Microsoft. LiteLLM’s own root-cause report, published later that day, sets out the chain itself (see below). Its advice: locate and contain every copy, rebuild from clean sources, rotate affected secrets from a trusted machine, and pin package hashes and image digests.

The malware runs even if LiteLLM is never imported

SafeDep’s analysis says all seven 1.107.0 wheels, covering Linux, macOS and Windows, drop three extra files into the Python environment, and that two of them run whenever any Python process starts on the machine, “even one that never imports litellm”. The source code on GitHub does not contain them.

The first is a credential stealer. According to SafeDep, it collects SSH keys, cloud credentials, CI/CD secrets, browser passwords and tokens for AI coding tools, and dumps the LLM provider API keys held in a LiteLLM proxy’s database. It encrypts what it finds and sends it to www.litellm[.]dev. The second file starts a background process that, every hour, reads a server address from a file on GitHub, runs the stealer again, and downloads and runs whatever code that server supplies.

SafeDep says the GitHub account hosting that address file was deleted by 14:40 BST, so the backdoor now has nowhere to call. But it warns that “hosts that ran the daemon before the deletion could have received and run second-stage code”, and it could not recover the server address.

A key leaked in May and never revoked opened the way, LiteLLM says

LiteLLM’s root-cause report, published on 23 October by its director of security, Oliver Jensen, and AI engineer Mateo Wang, calls itself “the canonical source of truth”. It says “some assumptions and beliefs” in the status updates posted during the investigation “were later proven to be inaccurate or incomplete”. “Our first post suspected the tokens were taken from the logs of an internal LiteLLM deployment,” it says. The first token in fact came from a different service.

The chain starts on 27 May. At 19:53 BST, a configuration file containing the master key to a deployment of the LiteLLM Agent Platform, an open-source tool the company uses to orchestrate agents, was committed to the public LiteLLM-Labs/lite-harness repository. “The error was quickly identified, the commit force-pushed over, and we identified the exposed keys as requiring revocation. However, key revocation did not occur for the master key.”

The platform filed pull requests using a GitHub token which, the report says, “was not associated with a service account and was not scoped down”. It was a GitHub CLI OAuth token belonging to the account of LiteLLM’s GitHub organisation owner. On 10 October, between 22:13 and 22:28 BST, the attacker used the master key against the platform, and at 22:27 one request returned that token. “From this point onwards, the threat actor had owner-level access to all repositories in our GitHub,” the report says, adding that GitHub CLI tokens “are post-2fa” and escape GitHub’s extra checks on sensitive actions.

Within the hour, the attacker ran throwaway workflows that posted CI secrets to an external webhook.site endpoint. At 23:11 BST, a run on BerriAI/litellm sent six secrets, including GH_TOKEN, which held a second maintainer’s GitHub CLI token. Seconds later, a run on BerriAI/litellm-auto sent RELEASE_PLEASE_TOKEN, which held a third maintainer’s. Both runs were deleted minutes later. On 12 October, between 13:08 and 13:30 BST, more workflows on private repositories posted all their secrets to the same endpoint, though LiteLLM says those were not used on the way to the poisoned release.

On 21 October at 11:08 BST, the attacker tried to push a change to the private BerriAI/project-releaser repository, letting the release workflow build from a source other than BerriAI/litellm. Branch protection rejected it under the second maintainer’s token. Five seconds later the owner’s token overrode the protection and the push went through. The attacker then pointed the workflow at commit 20535d8f on a lookalike fork, Berri-AI/litellm. The second maintainer’s token approved the production gate at 12:11 BST, and seven 1.107.0 wheels reached PyPI between 12:39 and 12:40 BST. The third maintainer’s token then deleted the run records, and the owner’s token was used to revert and force-push the change out of sight.

Normally, LiteLLM says, a release needs an authorised engineer and approval by “a special account locked to a physical device in our office”. “This restriction was relaxed earlier this week to accommodate the temporary push for more frequent releases and bugfix backports, allowing any two engineers to trigger and approve a release.” It says it is now “revoking every token associated with every internal system and vendor platform”, has removed every member of its GitHub organisation except one account temporarily promoted to owner, and will publish process changes next week. “This incident has provided a strong illustration of the risks associated with failing to rotate a potentially exposed key.”

SafeDep’s own reading, which it gives with moderate to high confidence, is that LiteLLM’s private release pipeline built the wheels from attacker-modified source code; it found no public GitHub Actions run that built them. “Only BerriAI’s pipeline logs can confirm the cause,” it says. The researcher who opened the issue, who signs the report as Upwind’s security research team, suggested the release was built from a lookalike repository. LiteLLM’s root-cause report now says its private release pipeline built the wheels from a commit on a lookalike fork, Berri-AI/litellm.

The maintainers say enterprise customers who pull from LiteLLM’s private registry are not affected. It resembles the attack TSN covered this week in which OVHcloud’s command-line tool was backdoored to steal secrets, and the hijacked AOMEI software updates that reached customers through a channel they trusted.

What users should do

LiteLLM’s advice to open-source users at the time was to pin version 1.106.2 or another explicit earlier release. Later releases, such as 1.106.6 on 28 October, have since appeared on PyPI; pinning explicit versions and hashes, rather than taking whatever is newest, remains the safer habit. SafeDep says 1.106.2 and the two 1.107.0 release candidates are clean. Docker users need to check too. The reporter says any pull of the “latest”, “main-latest” or “main-stable” tags from about 12:48 BST got the infected image; the issue’s status note says those tags no longer point to it. The root-cause report puts the publication of the Docker Hub and GHCR images at 12:46 BST.

For machines that did install 1.107.0, the issue’s remediation steps are blunt. Running pip in the affected environment triggers the malware again, so the reporter advises deleting cook.pth, cook.py and sitecustomize.py from site-packages first, stopping the background Python process, and preferably rebuilding the environment from scratch. Any host with internet access that ran 1.107.0 should be treated as having had its secrets taken. That means rotating cloud roles, the proxy’s database password and master keys, and every provider key stored in the proxy.

Revoking leaked keys and scoping tokens would have broken the chain

The lesson from the company’s account is that a leaked secret has to be treated as stolen the moment it is public. Force-pushing over the May commit removed the key from view, but the key kept working for more than four months. Revoking and rotating it, rather than only hiding it, is the step that would have closed the door. Teams that find a credential in a public repository should revoke it first and clean up the history second.

The second link was a token with too much reach. An experimental tool that only needed to open pull requests carried the organisation owner’s personal, unscoped GitHub CLI token, which could override branch protection. Automation should run on service accounts with the narrowest scopes it needs, and owner accounts should be kept few and out of tooling altogether.

The third was a release control loosened for convenience. Its hardware-bound approval would have required a device in its office; relaxing it to “any two engineers” meant two stolen tokens were enough. For compliance teams, temporary exceptions to release controls belong on the risk register, with an end date, and alerts on branch-protection overrides and deleted workflow runs give a chance to catch an attacker mid-chain. The company says its audit log recorded each override.

The stakes are rising because libraries like LiteLLM sit underneath many AI agent deployments, holding the keys to every model provider they call, and security flaws in agent tooling have become a regular theme. Upwind, the cloud security start-up whose researchers reported the poisoned release, has since raised $400m in a Series C round led by Bessemer.

Sources

Related stories

Follow @tsnmediahub on X for breaking AI news as it happens.

Follow on X

Share this story

Latest stories

More in this category

Latest stories

Explore the TSN Atlas: Every topic we cover, mapped. Click a bubble to dive in.