Malicious Code Detected in web3-ws Package - Security Alert
Summary
MAL-2025-47417: Malicious code in web3-ws (npm). Affected versions are not published. 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 web3-ws package is a widely used library in the npm ecosystem that facilitates WebSocket communication for Ethereum applications. It allows developers to interact with Ethereum nodes over WebSocket connections, enabling real-time updates and efficient data handling. However, recent findings have revealed that this package contains malicious code, posing significant security risks to applications that rely on it.
Vulnerability Detail
The vulnerability in the web3-ws package stems from the inclusion of malicious code that can compromise the security of applications using this library. This code may lead to unauthorized access, data breaches, or other malicious activities. The issue was identified in all versions starting from 0, indicating that any application utilizing this package is at risk. The ramifications of this vulnerability can be severe, affecting not only the integrity of the application but also the data and privacy of its users.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall web3-ws
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 measure, consider removing the web3-ws package from your project until a secure version is released. You can do this by executing the following command: npm uninstall web3-ws. Alternatively, you may explore other WebSocket libraries that do not have known vulnerabilities.
Conclusion
The discovery of malicious code in the web3-ws package highlights the importance of maintaining security in open-source libraries. Developers should promptly update their dependencies and monitor for vulnerabilities to protect their applications and users.
See every vulnerability recorded for web3-ws →
FAQ
The web3-ws package is used for enabling WebSocket communication with Ethereum nodes, allowing developers to receive real-time updates and interact with the Ethereum blockchain.
You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can access the Vulert playground at Vulert Scanner without any signup.
If you cannot update the package immediately, consider removing it from your project or using an alternative library until a secure version is available.
The malicious code in the web3-ws package was identified by security researchers from Amazon Inspector, who reported the findings to the community.
Using the compromised web3-ws package can lead to unauthorized access, data breaches, and other malicious activities that can harm both the application and its users.