# LiteLLM: tampered PyPI wheels used a .pth startup hook to harvest AI keys and Kubernetes secrets

- **Canonical URL:** https://breachidents.com/incidents/litellm-mar-2026-pypi-pth-stealer
- **Organization:** LiteLLM
- **Incident date:** Mar 24, 2026
- **Disclosed / updated:** Mar 24, 2026
- **Category:** CI supply chain
- **Primary source:** LiteLLM Founders Krrish Dholakia & Ishaan Jaffer (https://docs.litellm.ai/blog/security-update-march-2026)
- **Supply-chain group:** The Aqua Security Trivy, 2026 chain (https://breachidents.com/chains#chain-trivy-2026-supply-chain)

## In 30 seconds

- **How they got in:** LiteLLM assessed that the compromised Trivy CI/CD security scanning workflow exposed publishing credentials used to upload directly to PyPI _[Inferred]_
- **What leaked / reached:** PyPI releases litellm==1.82.7 (tampered proxy_server.py) and litellm==1.82.8 (litellm_init.pth auto-exec + proxy_server.py) stealing env vars, SSH, cloud, Kubernetes, and DB secrets
- **What stayed safe:** Official LiteLLM Proxy Docker image (ghcr.io/berriai/litellm), LiteLLM Cloud, pinned v1.82.6 installs, and LiteLLM’s GitHub main repository

## Summary

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.

## Attack sequence

1. **Mar 19–24, 2026 — Compromised PyPI credentials bypass LiteLLM CI to upload 1.82.7 and 1.82.8:** 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.
2. **Mar 24, 10:39–11:20 UTC — Unpinned pip installs pull litellm_init.pth, firing on every Python startup:** For 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.
3. **Mar 24–30, 2026 — Stealer posts secrets to models.litellm.cloud; LiteLLM ships clean v1.83.0 on CI v2:** Harvested 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.

## 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).

## What it reached

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.

## 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** (Stops step 1): 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** (Stops step 2): 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** (Catches step 3): 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.

## Evidence log

| Section | Claim | Evidence state | Source |
| --- | --- | --- | --- |
| How they got in | 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 |
| What it reached | 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 |
| What it reached | 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 |
| What held | 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

- **Domain:** `models.litellm[.]cloud` (undefined)
- **Domain:** `checkmarx[.]zone` (undefined)
- **File:** `litellm_init.pth` (undefined)

## Linked companies in this chain

- **Aqua Security Trivy** (Feb–Mar 2026): 76/77 Action tags, v0.69.4, and 3 linked breaches. Story: https://breachidents.com/incidents/aqua-trivy-mar-2026-supply-chain-cascade (Markdown: https://breachidents.com/incidents/aqua-trivy-mar-2026-supply-chain-cascade/md)
- **Checkmarx** (Mar 19–May 9, 2026): Actions, OpenVSX, KICS Docker, Jenkins, and repo leak. Story: https://breachidents.com/incidents/checkmarx-mar-2026-trivy-actions-cascade (Markdown: https://breachidents.com/incidents/checkmarx-mar-2026-trivy-actions-cascade/md)
- **European Commission** (Mar 19–25, 2026): 91.7 GB from 71 europa.eu clients. Story: https://breachidents.com/incidents/european-commission-mar-2026-aws-trivy (Markdown: https://breachidents.com/incidents/european-commission-mar-2026-aws-trivy/md)

---
Published by [breachidents](https://breachidents.com). Preserve evidence labels (Confirmed / Inferred / Withheld by vendor / Observed) when citing.
