Version 1.107.0 of LiteLLM, software that unifies and manages access to AI models, was found to contain credential-stealing malware and a mechanism for remote code execution. The malicious packages were distributed through PyPI and Docker registries on October 21, 2026. The maintainers say they have removed the affected releases and contained the incident. LiteLLM was also compromised in March of the same year, but this time the malicious files were absent from the official GitHub tag. Instead, a tampered distribution built from a different repository passed through the formal approval process. Moreover, once installed, the theft code can run during ordinary Python startup, even in programs that do not use LiteLLM. Reviewing the legitimate source code alone is not enough to judge safety; this incident requires investigating the files that were actually distributed and the environments where they run.
A tampered release that passed the legitimate approval process
According to the maintainers' official report, the attack abused the GitHub credentials of three engineers. A GitHub CLI OAuth token is believed to have been stolen, but how the attacker obtained it has not yet been determined. The official timeline says the attacker's unauthorized changes to the release process were initially rejected by branch protection. However, the protection settings were overridden using privileged account credentials, and production publication was approved by a different account. Workflow records needed for the investigation were then deleted using yet another set of credentials. The sequence shows that even a system separating the person who makes a change from the person who approves it can be bypassed if both sets of credentials are stolen.
The repository from which the malicious release was built also differed from the legitimate one. LiteLLM's official repository is BerriAI/litellm, but the problematic release was built from Berri-AI/litellm, whose name contains a hyphen. The official v1.107.0 source tag did not contain the malicious files, so examining the source code alone could not reveal the problem in the files actually delivered to users.
Security firm Socket confirmed this discrepancy by analyzing container build provenance in its own investigation. The Linux amd64 image it examined recorded Berri-AI as the source owner. The malicious files in that repository matched, byte for byte, the PyPI wheel files Socket inspected. By contrast, in the preceding version 1.106.2, the build provenance pointed to the legitimate BerriAI. Such provenance information is an important clue for tracing which source a release was built from, but it does not guarantee the safety of the build origin itself.
According to the maintainers' detailed report, the periods during which the malicious releases were available are as follows. All times are in Coordinated Universal Time (UTC) on October 21, 2026.
| Distribution channel | Affected versions/tags | Period malicious release was available |
|---|---|---|
| PyPI | All seven wheels of litellm==1.107.0 |
11:39:51–13:23 |
| Docker Hub | v1.107.0, latest, main-latest, main-stable |
11:46:56–14:20 |
| GHCR | LiteLLM-related images with the same tags | Available from 11:46:56; takedown confirmed by 13:51 |
Environments that used tags whose targets get updated, such as latest, may have pulled the malicious image even without explicitly specifying 1.107.0. Even after distribution was stopped, malicious files may remain in local caches and existing container images, so continued investigation is necessary. The maintainers say customers who obtain LiteLLM from private enterprise registries were not affected. Users of the open-source version are urged to pin to a previously verified version such as 1.106.2.
Credential-stealing code that runs without loading LiteLLM
GMO Flatt Security, through an investigation using its Takumi Guard analysis platform, reported that three files, cook.pth, cook.py, and sitecustomize.py, had been added to the malicious wheel. On installation, these files are placed directly in the Python environment's site-packages directory rather than in the LiteLLM library itself. Importantly, this placement means programs that do not use LiteLLM directly may also be affected.
cook.pth contains an import cook statement, which causes code that collects credentials to be loaded when Python starts. sitecustomize.py, the other entry point, is also a file Python automatically tries to load at startup. The official Python documentation describes how executable lines in .pth files and sitecustomize are loaded. Because the attacker abuses these standard startup mechanisms, applications do not need to import LiteLLM explicitly. In a Python environment where the malicious files remain, simply launching an ordinary program could trigger the theft code.
According to analyses by Socket and GMO Flatt Security, the credential collection code uses the name privcollect and has 16 collection modules. Its targets extend beyond cloud service credentials to SSH private keys and data stored in browsers. It also searches for authentication and configuration files used by AI development tools such as Codex, Claude, and Gemini, and on Linux it tries to obtain information from the environment variables of other processes that are readable under the permissions in effect. In other words, even with the same malware, the information at risk of leaking differs depending on where it runs, such as a developer's machine, a CI environment, or an AI gateway.
Credentials managed by LiteLLM itself are also targeted. If the DATABASE_URL environment variable is set, the malware attempts to query LiteLLM_CredentialsTable, which stores credentials, and LiteLLM_ProxyModelTable, which holds model settings. Because LiteLLM can centrally manage API keys for multiple AI services, the credentials of many services could be at risk depending on the compromised environment. For this reason, rotating only the API keys stored in files is not a sufficient response. However, the existence of code that attempts database access should be distinguished from having actually obtained and decrypted all information in each individual environment.
The destination for collected information was specified as www[.]litellm[.]dev/healthcheck, which looks like a legitimate diagnostic endpoint. According to Socket, the malware encrypts the collected data with AES-256-CBC and protects the encryption key with an RSA-4096 public key before sending it. Although the URL uses a name suggesting a health check, it is in fact a destination for exfiltrating credentials and other data.
Separately from credential theft, a mechanism for executing externally fetched Python code was also built in. A resident process launched from sitecustomize.py refers to domain.txt, placed in letters9813/pythonclient-test on GitHub. If a valid destination is specified in that file, the process fetches Python code from it and executes it without verifying the content through signatures or hashes. After checking the destination, it waits one hour, but this does not mean credential theft succeeded every hour.
The malware's behavior is also constrained by the OS and execution environment. According to JFrog's static analysis, on Windows the startup routine for the resident process, which depends on os.fork(), cannot complete, but the credential theft path via cook.pth remains. In the macOS distribution Socket examined, restrictions were observed in some database processing and in retrieving browser passwords in plaintext. When Socket checked at 13:01:44 UTC on October 21, domain.txt, which specifies the remote code source, was also empty. Even if the remote code execution path did not work, however, the independently operating credential collection code is not thereby neutralized. A particular feature not working cannot be taken as evidence that the entire environment is safe.
Recovery requires separately checking distributions, runtime environments, and credentials
The maintainers warn that in potentially affected environments, remediation should not begin with pip install. Because pip itself runs on Python, the malicious files could be executed again while checking state or reinstalling packages. Socket likewise recommends preserving evidence with trusted tools, isolating affected hosts and containers, and then rebuilding the environment. Simply uninstalling LiteLLM may leave behind the malicious files and resident processes embedded in Python's startup process.
In this incident, the legitimate source tag, the actual distributed files, and the running environments each need to be verified as separate objects. Even if the official tag is clean and the malicious versions have been removed from the distribution source, the safety of environments where they were already installed cannot be proven. Based on the maintainers' official report and Socket's analysis of the startup mechanism, the objects to check and the extent of what each piece of evidence can establish are summarized below.
| What to check | Evidence in this incident | What it cannot tell you alone |
|---|---|---|
| Source tag | The official tag does not contain the malicious files | Whether the wheels and container images actually distributed are safe |
| Distributed files and build provenance | Actual files, build source owner and revision, digests of running images | What was executed after installation |
| Runtime environment | Startup-related files, resident processes, communication logs, installation history | Whether data leakage can be ruled out when no evidence exists |
| Credentials | Keys, databases, and cloud permissions readable from the process | Whether removing the malware alone prevents misuse of leaked keys |
Stopping distribution only prevents the malicious packages from being newly obtained. In environments that already installed the malicious version, deleting LiteLLM itself may leave the malicious files directly under site-packages and resident processes in place. For this reason, the maintainers recommend rebuilding with clean container images or Python virtual environments. And if credentials may have been sent externally, the relevant credentials must be revoked and reissued from a safe environment separate from the infected one. Malware removal and credential revocation must proceed as independent responses.
The credentials the maintainers ask users to check include not only the API keys for each AI provider stored in LiteLLM's proxy database but also master keys and virtual keys. Database connection passwords and cloud IAM roles available to the execution environment are also subject to investigation. Considering the AI development tool credentials revealed in GMO Flatt Security's analysis, it is inappropriate to limit the scope of investigation to LiteLLM-specific API keys. It is necessary to confirm which files, services, and permissions the actually compromised process could access, and to identify credentials that may have leaked.
On the other hand, failing to find marker files or lock files that would indicate infection does not guarantee safety, because replacing containers or deleting temporary files can erase traces. Nor can the mere presence of sitecustomize.py be taken as proof of infection, since the file is also used by legitimate Python mechanisms. Rather than relying on whether certain filenames exist, it is important to examine file contents and cross-check execution history and communication logs.
In response to the incident, the maintainers revoked the related tokens, temporarily restricted new members from joining the GitHub organization, and removed trust relationships with the registries. However, the investigation into how the attacker first obtained the credentials is continuing, and no evidence has been presented that the same attacker or intrusion route was behind the March compromise. What this incident has made clear is that keeping a record of release approvals is not enough to guarantee the safety of distributed files. A mechanism that permits publication only of artifacts generated from pre-approved repositories and revisions will be important for supply chain protection. On the user side as well, in addition to verifying the legitimate source, it is necessary to cross-check the packages actually obtained and the container images in operation, confirming safety from distribution through execution.



