Critical Malicious Code Vulnerability in pre-and-postinstall-scripts-example Package
Summary
MAL-2025-6116: Malicious code in pre-and-postinstall-scripts-example (npm). Affects pre-and-postinstall-scripts-example versions >= 7.0.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 pre-and-postinstall-scripts-example package is an npm package designed to demonstrate the use of pre-install and post-install scripts in Node.js applications. While it serves as a useful educational tool, it has been found to contain malicious code that communicates with a domain associated with harmful activities, posing a significant security risk to users and their systems.
Vulnerability Detail
The vulnerability originates from the package's embedded malicious code, which can compromise any computer that has this package installed or running. This malicious code can lead to unauthorized access to sensitive information, including secrets and keys stored on the affected computer. The presence of this code indicates that the system may be fully compromised, necessitating immediate action to mitigate potential damage.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall pre-and-postinstall-scripts-example
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 workaround, users can temporarily disable the execution of scripts during installation by using the following command: 'npm install --ignore-scripts'. However, this does not eliminate the risk associated with the malicious package and should only be considered a short-term measure.
Conclusion
The pre-and-postinstall-scripts-example package contains a critical vulnerability due to embedded malicious code. Users must take immediate action to remove the package and secure their systems. Regular monitoring for vulnerabilities using tools like Vulert is essential to maintain software security.
See every vulnerability recorded for pre-and-postinstall-scripts-example →
FAQ
The malicious code in the pre-and-postinstall-scripts-example package communicates with a domain linked to malicious activities, potentially compromising user data.
If you have installed the pre-and-postinstall-scripts-example package, your system may be affected. You can use Vulert to monitor and alert for open-source vulnerabilities in your software.
If you suspect a compromise, immediately remove the package, rotate all sensitive keys and secrets, and consider performing a full security audit of your system.
Yes, you can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any installation or signup.
Long-term implications include potential data breaches, unauthorized access to sensitive information, and the risk of further malware installation on the compromised system.