Skip to content
AI & Technologie

Poisoned LiteLLM 1.107.0 on PyPI Steals Credentials Whenever Python Starts: What to Check in Your Projects

4 min read

If your projects use LiteLLM, the gateway library for calling AI models, check which version you have. On October 21, 2026, a malicious version 1.107.0 reached PyPI and the official container images. According to Microsoft’s analysis, its code runs every time Python starts, even if you never import LiteLLM. What exactly happened, and what should you do?

What happened

The malicious litellm 1.107.0 was published to PyPI on October 21, 2026, and was quarantined after a little under two hours. It also reached the container images on Docker Hub and GHCR, so anyone deploying LiteLLM as a ready-made image is affected too. The project says all previous versions are safe and that the official 1.107.0 source tag on GitHub did not contain the malicious files.

According to LiteLLM, the attackers used stolen GitHub CLI OAuth tokens belonging to three developer accounts. With them they interfered with the release controls, published the malicious artifacts and tried to cover their tracks. As of October 25 the initial access vector was still under investigation, so we do not describe it here.

Why it is nasty: it runs when Python starts

According to Microsoft’s analysis of October 23, the package installed the files cook.pth, cook.py and sitecustomize.py directly into the environment’s library directory, outside its own code. Python processes .pth files during initialization, so the malicious code runs on every interpreter start, even if LiteLLM is never imported. Microsoft describes a Windows case where simply running Python to install an unrelated dependency was enough.

What the malware collected

It is a credential stealer. According to Microsoft it targeted configuration and authentication files of AI assistants and developer tools, Git and package-manager credentials, .env files, private keys (SSH, GPG, TLS), AWS, Azure and Google Cloud access, Kubernetes and Docker. On hosts running the LiteLLM proxy it also went after selected fields from the database holding model-provider keys. The collected data was encrypted and sent to the attacker’s server.

Microsoft also notes that one of the loaders (sitecustomize.py) can fetch further code, but it did not confirm that a second stage was retrieved or executed. Package presence alone is therefore not proof of compromise, yet for every hit it is sensible to assume the worst.

What to check

  • Find every copy: virtual environments, pip and uv caches, internal mirrors, lock files, build outputs and container images. Compare them with the published hashes.
  • Do not run Python in a suspect environment. Investigate from a clean system, because .pth files are processed at startup.
  • Deleting the litellm folder is not enough. Confirm that cook.pth, cook.py and sitecustomize.py are gone as well, and rather rebuild the environment from verified artifacts.
  • Rotate credentials from a clean machine: AI provider keys, cloud and CI/CD secrets, tokens, and SSH or GPG keys. Revoke active sessions too, since rotation alone may not invalidate live tokens.
  • Pull containers by digest and delete local copies of the affected images.

Lessons for every project

The recommendations agree: use hash-pinned lock files, pin containers by digest instead of mutable tags, and restrict outbound HTTP traffic from developer and build servers. With third-party packages, assume even a trusted project can have a poisoned release for a few hours, and do not roll out new versions automatically the moment they appear.

Conclusion

The LiteLLM attack shows that AI-related dependencies are as attractive a target as classic libraries, and they sit next to keys that cost real money. Check your versions, environments and containers. If you need help auditing your servers and projects or setting up safer deployments, get in touch.

Sources: Microsoft Security Blog (October 23, 2026), statements from the LiteLLM project as cited in Shattered.io’s write-up.

Potřebujete pomoc s webovým projektem?

Rádi vám pomůžeme. Konzultace je zdarma a nezávazná.

Poraďte se s námi
Let's collaborate

Tell us about your project

Describe your project and we'll get back to you.

50+ satisfied companies
We reply within 24h
Free consultation
Bc. Martin Procházka
founder & developer
Please enter your name.
Please enter a valid email address.
Please enter a valid phone number.
Please describe what you need.
You must agree to the processing of personal data.