LiteLLM: tampered PyPI wheels used a .pth startup hook to harvest AI keys and Kubernetes secrets
On March 24, 2026 starting at 10:39 UTC, an attacker bypassed LiteLLM’s official CI pipeline and uploaded tampered versions 1.82.7 and 1.82.8 directly to PyPI for roughly 40 minutes before PyPI quarantined them. Version 1.82.8 embedded litellm_init.pth, executing automatically every time Python started to sweep environment variables, SSH keys, AWS/GCP/Azure credentials, and Kubernetes tokens to models.litellm.cloud. LiteLLM traced the root cause to the compromised Trivy dependency in its CI scanning workflow; LiteLLM Cloud, the official Docker image, and GitHub main stayed clean.
How they got in
LiteLLM sits in the middle of thousands of AI gateways, agent frameworks, and MCP servers, which means its runtime environment almost always holds OpenAI, Anthropic, Bedrock, and cloud credentials.
On March 24, 2026 at 10:39 UTC, an attacker bypassed LiteLLM's official CI/CD release workflow and uploaded two tampered releases (1.82.7 and 1.82.8) directly to PyPI. LiteLLM's founders assessed that the stolen publishing credentials traced back to the compromised Trivy dependency running inside LiteLLM's CI/CD security scanning workflow five days earlier (an attribution kept transparently marked inferred while investigation continued, reinforced on March 26 when checkmarx[.]zone appeared in the IOCs).
Starting at 10:39 UTC on March 24, an attacker using credentials believed exposed in the March 19 Trivy CI wave uploads litellm 1.82.7 and 1.82.8 directly to PyPI.
Trivy CI secret leaklitellm 1.82.7 & 1.82.8For roughly 40 minutes before PyPI quarantine, unpinned installs and transitive AI agent builds pull litellm==1.82.8, whose .pth hook executes automatically on interpreter start.
litellm 1.82.7 & 1.82.8litellm_init.pth hookHarvested cloud, Kubernetes, SSH, and LLM secrets are POSTed to models.litellm.cloud; LiteLLM pauses releases, verifies GitHub main is clean, and ships v1.83.0 on March 30.
litellm_init.pth hookCloud, K8s & LLM keys
Figure 1. How the attack unfolded, and what stayed isolated. Select any step or box for details.
What they took
The bad wheels stayed live on PyPI for roughly 40 minutes before PyPI quarantined them, yet 40 minutes is an eternity for automated Docker builds and unpinned transitive installs inside AI agent frameworks.
Version 1.82.7 injected a credential stealer into proxy_server.py. Version 1.82.8 went further by dropping litellm_init.pth directly into site-packages. Python automatically executes import lines inside .pth files every single time the interpreter starts, so any container or workstation that ran pip install litellm triggered the stealer on the very next python invocation without ever importing LiteLLM. Harvested environment variables, SSH keys, AWS/GCP/Azure credentials, Kubernetes tokens, and database passwords were encrypted and POSTed to a lookalike domain (models.litellm.cloud) not controlled by BerriAI.
How one breach rippled into 3 more companies
See the whole chain76/77 Action tags, v0.69.4, and 3 linked breaches
Actions, OpenVSX, KICS Docker, Jenkins, and repo leak
91.7 GB from 71 europa.eu clients
Tampered PyPI wheels 1.82.7 & 1.82.8 (~40 min live)
76/77 Action tags, v0.69.4, and 3 linked breaches
Actions, OpenVSX, KICS Docker, Jenkins, and repo leak
91.7 GB from 71 europa.eu clients
Tampered PyPI wheels 1.82.7 & 1.82.8 (~40 min live)
What stayed safe
Strict dependency pinning saved LiteLLM's own official container image (ghcr.io/berriai/litellm), which pinned exact package versions in requirements.txt and never pulled the rogue PyPI uploads. LiteLLM Cloud, installs pinned to v1.82.6 or earlier, and the GitHub main repository also remained untouched. On March 30, LiteLLM resumed releases with clean v1.83.0 built on an isolated "CI/CD v2" pipeline.
How to defend against this
PyPI Trusted Publishers
Disable static maintainer PyPI API tokens and require PyPI Trusted Publishers (OIDC) tied strictly to isolated release workflows separate from third-party scanners.
Pin hashes & scan .pth
Pin Python dependencies with pip --require-hashes (or uv/Poetry lockfiles) and fail CI builds whenever a newly installed wheel adds an unexpected site-packages/*.pth file.
Egress-allowlist AI builds
Restrict outbound DNS and HTTPS egress from build containers and AI gateway pods so rogue lookalike domains like models.litellm.cloud cannot receive exfiltrated secrets.
audit-python-pth-files.shInspect Python site-packages for litellm_init.pth or compromised litellm versions 1.82.7/1.82.8.
#!/usr/bin/env bashset -euo pipefailpython3 -c "import importlib.metadata as m; print('litellm:', m.version('litellm'))" 2>/dev/null || echo "litellm not installed"python3 -c "import site, pathlib; [print(p) for d in site.getsitepackages() for p in pathlib.Path(d).glob('*.pth')]"Appendix
Evidence log: what’s confirmed and what’s withheld
| Claim | Status | Source |
|---|---|---|
| LiteLLM assessed that the compromise originated from the compromised Trivy dependency in its CI/CD security scanning workflow, exposing credentials used to upload directly to PyPI | Inferred | LiteLLM Security Update, Mar 24–30, 2026 |
| litellm==1.82.7 (malicious proxy_server.py) and litellm==1.82.8 (litellm_init.pth + proxy_server.py) were live on PyPI starting March 24 at 10:39 UTC for roughly 40 minutes | Confirmed | LiteLLM Security Update, Mar 24, 2026 |
| The stealer harvested env vars, SSH keys, AWS/GCP/Azure credentials, Kubernetes tokens, and database passwords and POSTed them to rogue domain models.litellm.cloud (checkmarx[.]zone also added to IOCs on March 26) | Confirmed | LiteLLM Security Update, Mar 24–26, 2026 |
| The official LiteLLM Proxy Docker image (ghcr.io/berriai/litellm), LiteLLM Cloud, installs pinned to v1.82.6 or earlier, and LiteLLM’s GitHub main branch were unaffected | Confirmed | LiteLLM Security Update, Mar 24–30, 2026 |
Indicators of compromise
models.litellm[.]cloudcheckmarx[.]zonelitellm_init.pth
Reproduction lab
List every .pth startup hook installed across your Python virtual environments and verify no image or lockfile references litellm 1.82.7 or 1.82.8.
bash audit-python-pth-files.sh