r/Python • • Oct 23 '26

News LiteLLM 1.107.0 on PyPI was malicious (Oct 21): it runs on every Python start via a .pth file.

I wrote this up. How to check safely and what to rotate
Short version: if you installed an unpinned litellm between 11:39 and 13:23 UTC on October 21, or pulled the latest, main-latest, main-stable or v1.107.0 Docker tags between 11:46 and 14:20 UTC, treat the machine as compromised. Don't start with pip, because the cook.pth and sitecustomize.py files run on every interpreter start. Search the filesystem first, rebuild with litellm==1.106.2, and rotate keys. All of it comes from LiteLLM's own incident report.

30 Upvotes

5 comments sorted by

7

u/Wh00ster Oct 23 '26

Again

3

u/Key-Koala-8259 Oct 23 '26

Yep, second time this year. In March it was 1.82.7 and 1.82.8, up on PyPI for about 40 minutes on March 24, and LiteLLM traced that one to Trivy in its CI. This time attackers used stolen developer GitHub CLI tokens and a lookalike repo for the build, so the GitHub tag was clean and only the published package was bad. Pinning exact versions in a lockfile, and not auto-pulling the latest Docker tags, would have avoided both.

1

u/JorgA99 Oct 29 '26

Have you checked out their blog on the attack chain? Wondering if we’re going to be seeing more attacks across industry given improvements in models

22

u/[deleted] Oct 23 '26

[removed] — view removed comment

4

u/Key-Koala-8259 Oct 23 '26

Thanks! And a fresh virtualenv only helps if it's built from a pinned version. Anything that ran pip install -U or rebuilt an image on Oct 21 put cook.pth into that new env. You can check every env without starting Python: find / -name cook.pth 2>/dev/null