Malicious Code Exfiltration in serpapi-python Package
Summary
MAL-2026-702: Malicious code in serpapi-python (PyPI). Affects serpapi-python versions 0.0.0 – 0.1.5. 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 serpapi-python package is a Python client for the SerpApi service, which allows users to scrape search engine results. It is designed to facilitate the retrieval of search data in a structured format. However, this package has been found to contain malicious code that compromises user data by exfiltrating sensitive information from the host system.
Vulnerability Detail
The vulnerability originates from the package's installation process, where it overrides the install command in setup.py to execute malicious code. This code is designed to exfiltrate basic information about the host, such as the IP address and username, posing a risk to user privacy and security. The package has no legitimate purpose beyond this malicious activity, making it a significant threat to users who install it.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
pip uninstall serpapi-python
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 specific workarounds for this vulnerability other than avoiding the installation of the serpapi-python package. If you have already installed it, ensure to uninstall it immediately.
Conclusion
The serpapi-python package has been identified as containing malicious code that exfiltrates sensitive information from the host system. Users are advised to uninstall the affected versions and consider alternative packages for their needs. Utilizing tools like Vulert can help monitor for such vulnerabilities in real-time.
See every vulnerability recorded for serpapi-python →
FAQ
The serpapi-python package is a client for the SerpApi service, allowing users to scrape and retrieve search engine results in a structured format.
The malicious code executes during the installation process, exfiltrating sensitive information such as the user's IP address and username.
The affected versions of the serpapi-python package are 0.0.0 and 0.1.5.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
If you have installed the serpapi-python package, you should uninstall it immediately using the command: pip uninstall serpapi-python.