LiteLLM's .pth Backdoor Introduces a Supply Chain Attack Class Your Tools Can't Detect
A Novel Python Attack Vector That Fires Without Import
The LiteLLM compromise (versions 1.82.7 and 1.82.8) is architecturally distinct from the Trivy incident covered earlier this week. The attacker — who compromised the LiteLLM CEO's GitHub account — injected a .pth file into the package. Python's .pth mechanism executes arbitrary code when the interpreter starts up, before any imports. You don't need to import litellm for the payload to fire. Simply having the compromised version installed in your virtualenv is enough.
What Was Exfiltrated
The payload targeted 9+ credential categories: cloud provider keys (AWS/GCP/Azure), SSH keys, Kubernetes configs, git credentials, all environment variables, shell history, crypto wallets, SSL private keys, CI/CD secrets, and database passwords. One additional detail: the payload runs rm -rf / if the system timezone is Asia/Tehran — suggesting either a geopolitical targeting component or state-level backing.
Why Your Scanners Are Blind
pip audit, Dependabot, Snyk, and every standard Python security scanner focuses on known CVEs in package metadata. None of them scan for malicious .pth files in site-packages.
This is the critical gap. The compromised versions were quarantined on PyPI, but if they're already in your Docker images, CI caches, or production virtualenvs, the quarantine does nothing. Karpathy publicly flagged transitive risk — packages like DSPy depend on LiteLLM, meaning you may have pulled it without knowing. A separate attack technique compounds the problem: attackers spammed the GitHub vulnerability report with AI-generated comments to bury legitimate security warnings — a new adversarial playbook using AI to defeat human-scale triage.
Cross-Source Pattern: Security Tools as Attack Surface
This week's pattern is unmistakable: TeamPCP also compromised KICS (Checkmarx's GitHub Actions and VS Code extensions), and a self-propagating npm worm (CanisterWorm) with a destructive payload is spreading through the DevOps ecosystem. The recursive nightmare is real — your security scanners, AI proxy libraries, and development tools are now the primary attack vectors.
Remediation Playbook
- Check now: Run
pip freeze | grep litellmacross all environments. Check Docker images, CI caches, and lock files for versions >= 1.82.7. - Rotate everything: If found, rotate ALL credentials — cloud IAM, SSH keys, K8s configs, CI/CD tokens, DB passwords, API keys.
- Add .pth scanning: Write a pre-install hook or post-install check that alerts on unexpected
.pthfiles insite-packages. No commercial scanner catches this today. - Pin to SHA256 digests: Stop trusting package version strings. Use
pip install --require-hashesand consider vendoring critical AI middleware.
What to do
Run `pip freeze | grep litellm` across ALL environments (dev, CI, staging, prod) today
Add .pth file scanning to your CI/CD security pipeline this sprint
Implement pip --require-hashes and evaluate vendoring LLM routing middleware this quarter