LiteLLM Supply Chain Attack Exposes Critical Gap: GitHub Audits Miss PyPI Compromises
Key Takeaways
- ▸LiteLLM, with 95 million monthly downloads, was compromised through stolen PyPI credentials, not GitHub repository infiltration, demonstrating that code audits alone cannot verify package integrity
- ▸Attackers used .pth files—a little-known Python auto-execution mechanism—to harvest credentials without requiring package imports, making detection extremely difficult
- ▸LLM gateway libraries are prime targets because they centralize access credentials for all integrated AI providers, giving attackers comprehensive infrastructure access
Summary
On March 24, 2026, LiteLLM, a widely-used Python package with over 95 million monthly downloads, fell victim to a sophisticated supply chain attack. Threat actors from a group known as TeamPCP compromised the package maintainer's PyPI publishing credentials and uploaded malicious versions (1.82.7 and 1.82.8) that stole sensitive credentials including SSH keys, cloud provider credentials, Kubernetes secrets, API keys, cryptocurrency wallets, and database passwords. The attack was particularly insidious because the source code on GitHub remained clean throughout, meaning traditional security audits of the repository would have detected nothing.
The attackers exploited a little-known Python mechanism called .pth files, which auto-execute code upon Python interpreter startup without requiring explicit imports. This meant that simply having the compromised package installed was sufficient to trigger the malware, which harvested credentials, established persistence via systemd, and attempted lateral movement through Kubernetes clusters. LLM gateway libraries like LiteLLM are uniquely high-value targets because they inherently hold API keys for multiple LLM providers including OpenAI, Anthropic, Google, Azure, Cohere, and others—essentially giving attackers master keys to an organization's AI infrastructure.
The malicious versions remained live for less than an hour and were discovered only due to a bug in the malware that caused a system crash. Security experts noted that without this accidental detection trigger, the compromise could have gone undetected for days or weeks, potentially affecting thousands of organizations. The incident reveals a critical vulnerability in the Python packaging supply chain: the divergence between audited GitHub source code and distributed PyPI artifacts.
- The attack remained undetected for less than an hour only due to a malware bug; without it, compromise could have lasted days or weeks affecting thousands of organizations
- Remediation strategies include pinning exact versions with hash verification, auditing .pth files, using PyPI trusted publishers (OIDC-based), comparing distributed artifacts against source, and deploying private package mirrors with allowlists
Editorial Opinion
The LiteLLM incident represents a watershed moment for AI infrastructure security, exposing a dangerous assumption that audited source code guarantees safe distributed artifacts. As LLM integrations become increasingly central to enterprise operations, the trust placed in gateway libraries creates catastrophic risk—a single compromised dependency provides attackers with master keys to an organization's AI and cloud infrastructure. This attack underscores that AI security maturity requires moving beyond code review to artifact verification, trusted publisher mechanisms, and defensive supply chain practices that are still nascent in the Python ecosystem.



