Malicious Code Vulnerability in py-sock2: Remote Code Execution and File Exfiltration
Summary
MAL-2026-17881: Malicious code in py-sock2 (PyPI). Affects py-sock2 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
py-sock2 is a Python package available on PyPI that is designed for socket programming. It allows developers to create network applications using Python's socket interface. However, a recent malicious version of this package has been identified, which introduces severe security risks, including the ability to execute remote commands and exfiltrate sensitive files from the victim's machine.
Vulnerability Detail
The vulnerability originates from a malicious version of the py-sock2 package, specifically version 0.1.0, which was uploaded by a user identified as kam193. This version installs a persistent job on the victim's machine, allowing the attacker to exfiltrate files and execute remote code. The malicious code is designed to run automatically, making it difficult for users to detect or remove it. The implications of this vulnerability are severe, as it can lead to unauthorized access to sensitive information and control over the victim's system.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
pip uninstall py-sock2
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
As a temporary workaround, avoid using the py-sock2 package until a secure version is released. If you must use it, consider isolating your environment using virtual environments or containers to limit the potential impact of the malicious code.
Conclusion
The py-sock2 package has been compromised, leading to significant security vulnerabilities that can affect users' systems. It is essential to take immediate action to remove the malicious version and monitor for any signs of compromise. Utilizing tools like Vulert can help in identifying and managing such vulnerabilities effectively.
See every vulnerability recorded for py-sock2 →
FAQ
py-sock2 is a Python package designed for socket programming, enabling developers to create network applications.
You can check if your application is affected by this vulnerability using Vulert's playground at Vulert Scanner, which monitors open-source vulnerabilities in real-time.
Immediately uninstall the package using pip uninstall py-sock2 and monitor your system for any unusual activity.
To prevent future vulnerabilities, regularly update your packages, use tools like Vulert to monitor for vulnerabilities, and review package sources before installation.
The risks include unauthorized access to sensitive files, execution of remote commands, and potential control over the victim's machine.