{"incident":{"slug":"litellm-mar-2026-pypi-pth-stealer","caseId":"BI-2026-030","organization":"LiteLLM","title":"LiteLLM: tampered PyPI wheels used a .pth startup hook to harvest AI keys and Kubernetes secrets","shortSummary":"On March 24, 2026, attackers believed to have stolen publishing credentials through LiteLLM’s Trivy CI workflow pushed litellm 1.82.7 and 1.82.8 to PyPI, exfiltrating cloud and LLM secrets to models.litellm.cloud.","lede":"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.","incidentDate":"Mar 24, 2026","incidentDateIso":"2026-03-24","disclosedDate":"Mar 24, 2026","sourceUrl":"https://docs.litellm.ai/blog/security-update-march-2026","sourceAuthor":"LiteLLM Founders Krrish Dholakia & Ishaan Jaffer","vectorFilter":"CI supply chain","timeToDetect":"~40 minutes (live from 10:39 UTC before PyPI quarantine)","detectedBy":"Community developers and PyPI Security","initialAccess":{"label":"Compromised PyPI credentials from Trivy CI wave","detail":"LiteLLM assessed that the compromised Trivy CI/CD security scanning workflow exposed publishing credentials used to upload directly to PyPI","evidence":"inferred"},"blastRadius":"Tampered PyPI wheels 1.82.7 & 1.82.8 (~40 min live)","whatItReachedShort":"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","whatHeldShort":"Official LiteLLM Proxy Docker image (ghcr.io/berriai/litellm), LiteLLM Cloud, pinned v1.82.6 installs, and LiteLLM’s GitHub main repository","revisions":[{"id":"Rev A","date":"Mar 30, 2026","note":"Published from LiteLLM’s March 24–30, 2026 official security update (docs.litellm.ai/blog/security-update-march-2026), including the March 26 checkmarx[.]zone IOC and March 30 CI/CD v2 clean v1.83.0 release."}],"bodyMarkdown":"## How they got in\n\nLiteLLM 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.\n\nOn 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).\n\n## What it reached\n\nThe 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.\n\nVersion `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.\n\n## What held\n\nStrict 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.\n\n> **Why this matters for defenders**\n>\n> A `.pth` file in a Python wheel turns `pip install` into automatic code execution on every future Python command. Lock dependencies with cryptographic hashes (`pip --require-hashes` or `uv.lock`), isolate security scanners from release credentials, and move PyPI packages to OIDC Trusted Publishers.","narrative":{"howTheyGotIn":["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)."],"whatItReached":["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."],"whatHeld":["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."],"sideNoteTitle":"Why this matters for defenders","sideNoteParagraphs":["A `.pth` file in a Python wheel turns `pip install` into automatic code execution on every future Python command. Lock dependencies with cryptographic hashes (`pip --require-hashes` or `uv.lock`), isolate security scanners from release credentials, and move PyPI packages to OIDC Trusted Publishers."]},"claims":[{"group":"How they got in","claim":"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","evidence":"inferred","source":"LiteLLM Security Update, Mar 24–30, 2026"},{"group":"What it reached","claim":"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","evidence":"confirmed","source":"LiteLLM Security Update, Mar 24, 2026"},{"group":"What it reached","claim":"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)","evidence":"confirmed","source":"LiteLLM Security Update, Mar 24–26, 2026"},{"group":"What held","claim":"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","evidence":"confirmed","source":"LiteLLM Security Update, Mar 24–30, 2026"}],"cascade":{"id":"trivy-2026-supply-chain","title":"Aqua Security Trivy, 2026","shortLabel":"Trivy supply-chain cascade","summary":"Downstream PyPI credential-stealer publish at LiteLLM attributed to the March 19 Trivy CI supply-chain compromise."},"relations":[{"targetSlug":"aqua-trivy-mar-2026-supply-chain-cascade","organization":"Aqua Security Trivy","direction":"upstream","fromWave":"tv-w2","edgeLabel":"Trivy CI scanning job","mechanism":"LiteLLM assessed that stolen publishing credentials originated from the compromised Trivy dependency inside its CI/CD security scanning workflow.","date":"Mar 24, 2026","dateIso":"2026-03-24","evidence":"confirmed","linkEvidence":"inferred","sourceLabel":"LiteLLM Security Update, Mar 24–30, 2026","sourceUrl":"https://docs.litellm.ai/blog/security-update-march-2026"}],"diagram":{"label":"How a Trivy CI compromise led to tampered LiteLLM PyPI wheels with a .pth startup stealer","zones":[{"id":"ext","label":"Upstream Trivy CI wave","kind":"boundary","lane":0},{"id":"pypi","label":"Direct PyPI upload","kind":"boundary","lane":1},{"id":"env","label":"Python & AI environments","kind":"boundary","lane":2},{"id":"safe","label":"Pinned & hosted paths","kind":"isolated","lane":2}],"nodes":[{"id":"ll-tv","zone":"ext","name":"Trivy CI secret leak","detail":"Link assessed by LiteLLM","kind":"attacker","ev":"inferred","at":0,"when":"Mar 19, 2026","steps":[1],"linkedSlug":"aqua-trivy-mar-2026-supply-chain-cascade","linkedOrg":"Aqua Security Trivy","story":"LiteLLM reported it believed its PyPI publishing credentials were exposed by the compromised Trivy dependency running inside its CI/CD security scanning workflow."},{"id":"ll-pypi","zone":"pypi","name":"litellm 1.82.7 & 1.82.8","detail":"Direct PyPI push (40m)","kind":"compromised","ev":"confirmed","at":1,"when":"Mar 24, 10:39 UTC","steps":[1,2],"ctl":["ll-k1"],"story":"Bypassing official CI and GitHub main, the attacker uploaded litellm==1.82.7 (proxy_server.py) and litellm==1.82.8 (litellm_init.pth + proxy_server.py) to PyPI."},{"id":"ll-pth","zone":"env","name":"litellm_init.pth hook","detail":"Runs on Python startup","kind":"compromised","ev":"confirmed","at":2,"when":"Mar 24, 10:39–16:00 UTC","steps":[2,3],"ctl":["ll-k2"],"story":"Because Python executes .pth files in site-packages on every interpreter launch, merely installing litellm==1.82.8 triggered credential theft without ever importing litellm."},{"id":"ll-exfil","zone":"env","name":"Cloud, K8s & LLM keys","detail":"models.litellm.cloud","kind":"compromised","ev":"confirmed","at":3,"when":"Mar 24, 2026","steps":[3],"ctl":["ll-k3"],"story":"Harvested env vars, SSH keys, AWS/GCP/Azure credentials, Kubernetes tokens, and DB passwords were encrypted and POSTed to rogue domain models.litellm.cloud."},{"id":"ll-safe","zone":"safe","name":"Docker, Cloud & GitHub","detail":"Pinned builds untouched","kind":"isolated","ev":"confirmed","at":0,"when":"Not reached","story":"The official ghcr.io/berriai/litellm Docker image (pinned requirements.txt), LiteLLM Cloud, v1.82.6 or earlier, and LiteLLM’s GitHub main branch were not compromised."}],"edges":[{"id":"lle1","from":"ll-tv","to":"ll-pypi","kind":"attack","step":1},{"id":"lle2","from":"ll-pypi","to":"ll-pth","kind":"attack","step":2},{"id":"lle3","from":"ll-pth","to":"ll-exfil","kind":"attack","step":3}],"steps":[{"n":1,"time":"Mar 19–24, 2026","short":"Creds -> PyPI","text":"Compromised PyPI credentials bypass LiteLLM CI to upload 1.82.7 and 1.82.8","say":"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."},{"n":2,"time":"Mar 24, 10:39–11:20 UTC","short":".pth auto-exec","text":"Unpinned pip installs pull litellm_init.pth, firing on every Python startup","say":"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."},{"n":3,"time":"Mar 24–30, 2026","short":"Exfil & CI v2","text":"Stealer posts secrets to models.litellm.cloud; LiteLLM ships clean v1.83.0 on CI v2","say":"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."}],"controls":[{"id":"ll-k1","step":1,"kind":"control","nodeId":"ll-pypi","name":"PyPI Trusted Publishers","tag":"Stops step 1","long":"Disable static maintainer PyPI API tokens and require PyPI Trusted Publishers (OIDC) tied strictly to isolated release workflows separate from third-party scanners."},{"id":"ll-k2","step":2,"kind":"control","nodeId":"ll-pth","name":"Pin hashes & scan .pth","tag":"Stops step 2","long":"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."},{"id":"ll-k3","step":3,"kind":"detection","nodeId":"ll-exfil","name":"Egress-allowlist AI builds","tag":"Catches step 3","long":"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."}],"detectedAt":{"time":"Mar 24, 2026 (~40 minutes after 10:39 UTC upload)","short":"Mar 24 (40m)","text":"PyPI quarantined 1.82.7 and 1.82.8 within ~40 minutes; LiteLLM published scanner scripts, verified hashes on March 27, and shipped clean v1.83.0 on CI/CD v2 on March 30."}},"plate":{"W":833,"H":382,"label":"How a Trivy CI compromise led to tampered LiteLLM PyPI wheels with a .pth startup stealer","zones":[{"id":"ext","label":"Upstream Trivy CI wave","kind":"boundary","x":8,"y":16,"w":272,"h":110},{"id":"pypi","label":"Direct PyPI upload","kind":"boundary","x":318,"y":16,"w":231,"h":110},{"id":"env","label":"Python & AI environments","kind":"boundary","x":587,"y":16,"w":238,"h":212},{"id":"safe","label":"Pinned & hosted paths","kind":"isolated","x":587,"y":248,"w":238,"h":110}],"nodes":[{"id":"ll-tv","name":"Trivy CI secret leak","detail":"Link assessed by LiteLLM","kind":"attacker","ev":"inferred","x":20,"y":52,"w":248,"at":0,"story":"LiteLLM reported it believed its PyPI publishing credentials were exposed by the compromised Trivy dependency running inside its CI/CD security scanning workflow.","when":"Mar 19, 2026","steps":[1],"linkedSlug":"aqua-trivy-mar-2026-supply-chain-cascade","linkedOrg":"Aqua Security Trivy"},{"id":"ll-pypi","name":"litellm 1.82.7 & 1.82.8","detail":"Direct PyPI push (40m)","kind":"compromised","ev":"confirmed","x":330,"y":52,"w":207,"at":1,"story":"Bypassing official CI and GitHub main, the attacker uploaded litellm==1.82.7 (proxy_server.py) and litellm==1.82.8 (litellm_init.pth + proxy_server.py) to PyPI.","when":"Mar 24, 10:39 UTC","steps":[1,2],"ctl":["ll-k1"]},{"id":"ll-pth","name":"litellm_init.pth hook","detail":"Runs on Python startup","kind":"compromised","ev":"confirmed","x":601,"y":52,"w":209,"at":2,"story":"Because Python executes .pth files in site-packages on every interpreter launch, merely installing litellm==1.82.8 triggered credential theft without ever importing litellm.","when":"Mar 24, 10:39–16:00 UTC","steps":[2,3],"ctl":["ll-k2"]},{"id":"ll-exfil","name":"Cloud, K8s & LLM keys","detail":"models.litellm.cloud","kind":"compromised","ev":"confirmed","x":601,"y":154,"w":209,"at":3,"story":"Harvested env vars, SSH keys, AWS/GCP/Azure credentials, Kubernetes tokens, and DB passwords were encrypted and POSTed to rogue domain models.litellm.cloud.","when":"Mar 24, 2026","steps":[3],"ctl":["ll-k3"]},{"id":"ll-safe","name":"Docker, Cloud & GitHub","detail":"Pinned builds untouched","kind":"isolated","ev":"confirmed","x":599,"y":284,"w":214,"at":0,"story":"The official ghcr.io/berriai/litellm Docker image (pinned requirements.txt), LiteLLM Cloud, v1.82.6 or earlier, and LiteLLM’s GitHub main branch were not compromised.","when":"Not reached"}],"edges":[{"id":"lle1","kind":"attack","step":1,"pts":[[268,81],[330,81]]},{"id":"lle2","kind":"attack","step":2,"pts":[[537,81],[601,81]]},{"id":"lle3","kind":"attack","step":3,"pts":[[706,110],[706,154]]}],"balloons":{"1":[299,81],"2":[569,81],"3":[706,132]},"noroute":[{"x1":549,"x2":587,"y":278,"label":"No route"}],"bps":[{"id":"ll-k1","step":1,"kind":"control","at":[299,81],"name":"PyPI Trusted Publishers","tag":"Stops step 1","lead":[[299,70],[299,53],[311,53]],"lx":317,"ly":57,"anchor":"start","long":"Disable static maintainer PyPI API tokens and require PyPI Trusted Publishers (OIDC) tied strictly to isolated release workflows separate from third-party scanners.","nodeId":"ll-pypi"},{"id":"ll-k2","step":2,"kind":"control","at":[569,81],"name":"Pin hashes & scan .pth","tag":"Stops step 2","lead":[[569,92],[569,103],[557,103]],"lx":551,"ly":107,"anchor":"end","long":"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.","nodeId":"ll-pth"},{"id":"ll-k3","step":3,"kind":"detection","at":[706,132],"name":"Egress-allowlist AI builds","tag":"Catches step 3","lead":[[706,121],[706,104],[694,104]],"lx":688,"ly":108,"anchor":"end","long":"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.","nodeId":"ll-exfil"}],"steps":[{"n":1,"time":"Mar 19–24, 2026","short":"Creds -> PyPI","text":"Compromised PyPI credentials bypass LiteLLM CI to upload 1.82.7 and 1.82.8","say":"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."},{"n":2,"time":"Mar 24, 10:39–11:20 UTC","short":".pth auto-exec","text":"Unpinned pip installs pull litellm_init.pth, firing on every Python startup","say":"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."},{"n":3,"time":"Mar 24–30, 2026","short":"Exfil & CI v2","text":"Stealer posts secrets to models.litellm.cloud; LiteLLM ships clean v1.83.0 on CI v2","say":"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."}],"stripRows":[{"id":"sr-ll-tv","nodeId":"ll-tv","lineStyle":"inferred"},{"id":"sr-step-1","nodeId":"ll-pypi","step":1,"lineStyle":"solid","bpIds":["ll-k1"]},{"id":"sr-step-2","nodeId":"ll-pth","step":2,"lineStyle":"solid","bpIds":["ll-k2"]},{"id":"sr-step-3","nodeId":"ll-exfil","step":3,"lineStyle":"none","bpIds":["ll-k3"]}],"detectedAt":{"time":"Mar 24, 2026 (~40 minutes after 10:39 UTC upload)","short":"Mar 24 (40m)","text":"PyPI quarantined 1.82.7 and 1.82.8 within ~40 minutes; LiteLLM published scanner scripts, verified hashes on March 27, and shipped clean v1.83.0 on CI/CD v2 on March 30."}},"codeArtifacts":[{"id":"ll-pth-audit","filename":"audit-python-pth-files.sh","language":"sh","description":"Inspect Python site-packages for litellm_init.pth or compromised litellm versions 1.82.7/1.82.8.","code":"#!/usr/bin/env bash\nset -euo pipefail\npython3 -c \"import importlib.metadata as m; print('litellm:', m.version('litellm'))\" 2>/dev/null || echo \"litellm not installed\"\npython3 -c \"import site, pathlib; [print(p) for d in site.getsitepackages() for p in pathlib.Path(d).glob('*.pth')]\"\n"}],"reproductionLab":{"title":"Python site-packages .pth audit","summary":"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.","bundleMeta":"Shell verification script, MIT license","safetyNote":"Read-only Python site-packages inspection.","commands":"bash audit-python-pth-files.sh\n"},"iocs":[{"type":"Domain","value":"models.litellm[.]cloud","note":"Unauthorized lookalike domain receiving encrypted POST exfiltration (not owned by BerriAI)","evidence":"confirmed"},{"type":"Domain","value":"checkmarx[.]zone","note":"Additional TeamPCP-linked domain added to LiteLLM’s IOC list on March 26, 2026","evidence":"confirmed"},{"type":"File","value":"litellm_init.pth","note":"Startup-executing .pth hook embedded inside litellm==1.82.8 on PyPI","evidence":"confirmed"}],"publishedAt":"2026-03-30T16:00:00Z","origin":"editorial"}}