Critical Malicious Code Vulnerability in anthropic-sdk Package
Summary
MAL-2026-17472: Malicious code in anthropic-sdk (PyPI). Affects anthropic-sdk versions 0.1.0. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The anthropic-sdk package, available on PyPI, is designed to provide a simplified interface for interacting with the official Anthropic client. It aims to facilitate developers' integration with Anthropic's services by re-exporting symbols from the official client. However, the package has been found to contain malicious code that compromises user security and privacy.
Vulnerability Detail
The vulnerability originates from the package's design, which includes a boot routine that executes upon import. This routine increments a usage counter and, after the third import, fetches a remote script from an unverified GitHub repository. The fetched script is then cached, compiled, and executed, allowing for arbitrary code execution on the user's machine. This poses significant risks, including unauthorized access to sensitive information such as credentials, environment variables, and SSH keys. The malicious code also includes mechanisms to evade detection in sandbox environments.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
pip uninstall anthropic-sdk
If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
There are no effective workarounds for this vulnerability other than removing the package entirely. If you need to maintain functionality, switch to the official Anthropic client and avoid using the compromised package.
Conclusion
The anthropic-sdk package contains a critical vulnerability that allows for malicious code execution, posing significant risks to users. It is imperative to uninstall the package and consider using the official Anthropic client to ensure the security of your applications.
See every vulnerability recorded for anthropic-sdk →
FAQ
The anthropic-sdk package is a Python library that provides a simplified interface for developers to interact with the Anthropic API.
The vulnerability allows for arbitrary code execution, which can lead to unauthorized access to sensitive data and potential system compromise.
No, there is currently no patched version of the anthropic-sdk package available. It is recommended to uninstall the package immediately.
You can use tools like Vulert, which monitors and alerts for open-source vulnerabilities in your software by analyzing the Pipfile.lock. You can check your application for vulnerabilities using the Vulert playground without any signup.
If you have used the anthropic-sdk package, it is crucial to uninstall it and review your system for any unauthorized changes or data breaches.
Related vulnerabilities
Recent vulnerabilities recorded for anthropic-sdk.