PSA: litellm PyPI package was compromised — if you use DSPy, Cursor, or any LLM project, check your dependencies
By Holidays in Europe / March 25, 2026 / No Comments / Uncategorized
Important Security Notice: Compromise of the litellm PyPI Package – Immediate Action Required for AI/LLM Developers
In the rapidly evolving landscape of AI and language model development, Python packages play a pivotal role in streamlining integration and deployment. One such widely adopted package is litellm, which acts as an all-in-one interface, allowing developers to seamlessly connect with leading providers such as OpenAI, Anthropic, Cohere, and others. With an impressive 97 million downloads per month, litellm has become a staple in many AI/LLM projects.
However, recent events have cast a shadow over this trusted library. A malicious version of litellm—specifically version 1.82.8—was uploaded to PyPI and briefly available for download. During that short window, anyone installing or updating this package inadvertently downloaded and executed code designed to exfiltrate sensitive information.
What Happened?
For approximately one hour after the malicious package’s appearance, executing pip install litellm or installing projects dependent on it, such as DSPy, inadvertently triggered a malicious payload. This payload stealthily collected and transmitted a wide array of sensitive data, including:
- SSH private keys
- Cloud provider credentials (AWS, GCP, Azure)
- Kubernetes configuration files
- Git credentials and command shell history
- Environment variables containing API keys, secrets, and tokens
- Cryptocurrency wallet private keys
- SSL private keys
- Secrets from Continuous Integration (CI/CD) pipelines
This attack was uncovered relatively early due to a user’s system crash, prompting a detailed investigation. Notably, Andrej Karpathy described the incident as “the scariest thing imaginable in modern software,” highlighting the severity and potential impact.
Immediate Actions for Developers
If you installed or updated any Python packages yesterday—especially DSPy or any library depending on litellm—assume your credentials and sensitive data may have been compromised. It is crucial to undertake immediate security measures:
- Identify if you installed the malicious package:
Review your recent installation history. You can check yourpiplogs or use the following command to list recent installations:
bash
pip list --format=freeze | grep litellm - Rotate all affected credentials and secrets:
- API keys (OpenAI, Cohere, Anthropic, etc.)
- Cloud access tokens and secrets
- SSH keys and other private keys
-
CI/CD secrets and environment variables
-
Review system and application logs:
Look for any suspicious activity or data exfiltration signs. -
Update
litellmto the official, non-malicious version:
Ensure you install the verified package version:
bash
pip install --upgrade litellm -
Invalidate or revoke compromised secrets:
This may include regenerating SSH keys, rotating cloud credentials, and updating secrets stored within CI/CD pipelines.
How to Protect Yourself Moving Forward
-
Verify packages before installation:
Always ensure the source and authenticity of the package. Prefer official repositories and verify the latest release versions. -
Maintain robust security practices:
Regularly rotate secrets, enable multi-factor authentication, and monitor for suspicious activity within your development environment. -
Stay informed:
Follow trusted security channels, update dependencies carefully, and subscribe to notifications regarding package security issues.
Final Thoughts
This incident underscores the importance of vigilant dependency management and security awareness within the software development community. While the PyPI ecosystem is typically secure, malicious packages can occasionally slip through, especially during periods of high activity or supply chain attacks.
If you suspect you’ve been impacted, act swiftly to secure your environment. The malicious package has been removed; however, the potential fallout necessitates proactive security measures.
Stay safe, stay vigilant.