Critical Malware Installation Vulnerability in napi-postinstall Package
Summary
MAL-2025-6025: Malicious code in napi-postinstall (npm). Affects napi-postinstall versions 0.3.1. 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 napi-postinstall package is an npm module designed to facilitate post-installation scripts for Node.js applications. It is commonly used to automate tasks that need to occur after a package is installed, such as compiling native add-ons. However, this package has been identified as having a severe vulnerability that allows malicious code to be executed during its installation process.
Vulnerability Detail
This vulnerability arises from the inclusion of a malicious file, node-gyp.dll, which is installed via the install.js script of the napi-postinstall package. This file is a Windows-based malware that can compromise the security of the system where the package is installed. The ramifications of this vulnerability include unauthorized access to sensitive data, system instability, and potential exploitation by attackers. The technical aspect of this vulnerability lies in the fact that the malicious code is executed without user consent during the installation phase, making it particularly dangerous.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall napi-postinstall
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, you can avoid using the napi-postinstall package until a secure version is released. Alternatively, you can manually check your package-lock.json file for any instances of napi-postinstall and remove it from your dependencies.
Conclusion
The napi-postinstall package has a critical vulnerability that allows the installation of malicious software during its setup process. It is vital for developers to take immediate action by updating their dependencies and monitoring for any updates regarding this issue. Utilizing tools like Vulert can help maintain the security of your applications.
See every vulnerability recorded for napi-postinstall →
FAQ
The vulnerability involves the installation of a malicious Windows-based file, node-gyp.dll, during the package's installation process.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without needing to sign up.
The consequences include unauthorized access to sensitive data, system instability, and exploitation by attackers.
Currently, there is no specific patch mentioned, but it is essential to keep an eye on updates for the napi-postinstall package.
As a temporary measure, consider removing the package from your dependencies or using an alternative package until a secure version is released.