r/Python • • Oct 21 '26

News litellm 1.107.0 on PyPI is compromised

the payloads run on every python start on the machine and not just when you import litellm. Your IDE, pip, CI jobs everything python on that host is affected.

It steals ssh keys, aws credentials, browser passwords, shell history and AI coding tool configs. The backdoor runs as a daemon and executes whatever code the attacker’s server returns every hour.

Pin to 1.106.2.

complete breakdown: safedep.io/litellm-pypi-compromise-credential-stealer-backdoor

416 Upvotes

44 comments sorted by

182

u/Nice_Mix_1021 Oct 21 '26

litellm again....!

169

u/Jmc_da_boss Oct 21 '26

Litellm is a vibe code piece of shit btw

45

u/JoNike Oct 21 '26

I contributed to it once and holy shit their git flow was confusing, no idea how a human could even follow what is happening there

45

u/marr75 Oct 21 '26 edited Oct 24 '26

That's the neat part! They can't.

7

u/russellvt Oct 21 '26

Irony at its best

9

u/wpg4665 Oct 21 '26

What else fills this niche that's not vibe coded at this point?

9

u/smakosh Oct 21 '26

Depends what you use it for. If it's only a couple of providers, the official SDKs (or the openai SDK pointed at any OpenAI-compatible endpoint) means one less dependency sitting next to all your keys. If you actually need a proxy, people usually look at Bifrost (Go), Portkey's gateway, or LLM Gateway.

Disclosure: I'm one of the people behind LLM Gateway (TypeScript, AGPLv3, self-host it or use the hosted one). We wrote up how to check a machine without starting python (that fires the payload again) and what to rotate, since it read the proxy's credentials table directly: https://llmgateway.io/blog/litellm-compromised-again

7

u/marr75 Oct 21 '26

There are a few quality projects that do it. Pydantic-ai with openrouter is my top recommendation but if you're using pydantic-ai, you barely need open router (although code free changes to models and providers and consolidated keys are nice).

1

u/venkat_1924 Oct 25 '26

Well there’re always enterprise alternatives like TrueFoundry.
I think they’ve got dev plans too iirc.

1

u/awolverp_ Oct 21 '26

It really is. I was trying to use it in a production project; I read its code and "wtf is this!"

37

u/RedEyed__ Oct 21 '26

Again. I wonder about maintainer trustworthiness

9

u/Ashamed-Simple-8303 Oct 21 '26

Probably more a competence thing or lack thereof

55

u/crossmirage Oct 21 '26

> The upstream pyproject.toml at tag v1.107.0 has no data = "cook" line and no cook/ folder. Someone changed the build outside the public repository.

So it's an intentional action by a maintainer (i.e. not a question of overlooking something snuck into an OSS contribution).

47

u/doomslice Oct 21 '26

well clearly CI got hacked (as is common)

35

u/pacific_plywood Oct 21 '26

Or compromised credentials/release pipeline

19

u/me_myself_ai Oct 21 '26

AFAICT the real problem is that they’re still building and releasing with a token directly rather than using GitHub as a Trusted Publisher. Which is a shame — now I have to switch out the whole gd service 😢

30

u/dudaspl Oct 21 '26

After the first breach I configured uv with 7d quarantine

16

u/hardolaf Oct 21 '26

We do 14 days at work and are considering upping it.

13

u/wRAR_ Oct 21 '26

That prevents installing fixed certifi, so...

23

u/cyberfunkr Oct 21 '26

You can add exceptions to project.toml and uv.lock so it can pull in the latest update immediately.

I just did that at work yesterday.

9

u/turbothy It works on my machine Oct 21 '26

Pick your poison. I've spent half the day bumping certifi pins, but I'd rather that than accidentally ingesting malware. Happens way less often for one.

5

u/misbahsy Oct 21 '26

This is contained. Please refer to the official blog for the latest updates on the situation - https://docs.litellm.ai/blog/security-incident-oct-21-2026

9

u/tedivm Oct 22 '26

What a shit show. Loose credentials, apparently they allow their branch protection to be bypassed instead of always requiring multiple people to sign off on things like changing github workflows, internal services exposed over the public internet, no filtering of logs even though they know they're leaking data into them. This is rather disturbing, especially after the previous incident which should have triggered a review and hardening.

That said GitHub also needs to clean up their shit. Removing branch protection should require reauthenticating with mfa. Attackers shouldn't be able to remove security features with CLI tokens.

2

u/RagnartheConqueror Oct 22 '26

Thanks for notifying us about this.

1

u/dmpiergiacomo Oct 22 '26

Ops they did it again...

1

u/Khavel_dev Oct 22 '26

The part that makes this one especially nasty is the scope. It doesn't just run when you import litellm, it hooks into every Python process on the machine. Your IDE, your CI, your package manager. And it specifically targets AI coding tool configs and API keys, so if you're running any LLM tools locally those credentials need rotating now.

If you had this version installed, pin and rotate everything. And lock the hash in your requirements file, not just the version number. An account that pushed a compromised package once can do it again.

1

u/fiddle_n Oct 23 '26

It’s $currentYear now - how about using proper lock files that would do this for you rather than still using pip + venv + requirements.txt .

But even then, one day you will need to update a package and then it’s Russian roulette as to whether you pull in a malicious one or not. Dependency cooldowns - these should be mandatory for everyone now.

1

u/Goldziher Pythonista Oct 22 '26

Switch to the xberg-io liter-llm, I'm the author:

https://github.com/xberg-io/liter-llm

1

u/senpaikcarter Oct 21 '26

Thankyou for this

1

u/openllm Oct 21 '26

If only there was an alternative... ;)

-1

u/No_Juggernaut_7205 Oct 22 '26

Have you tried checking the logs? Sometimes it's just a missing dependency.