Severity
Medium
Short Description
Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Packages
View packages with this alert.Suggestion
Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.
Install scripts are executed automatically when a package is installed, making them a potential vector for security risks. While some install scripts are necessary for setting up a package, many can be avoided or replaced with safer alternatives. Overuse or misuse of install scripts can lead to significant security vulnerabilities, as they can run arbitrary code on a user’s system during installation.
Why Install Scripts are a Concern
Packages should avoid running non-essential scripts during installation. There are often alternative solutions to the problems solved by install scripts, such as executing necessary actions at publish time instead. This reduces the attack surface and limits the risk of malicious code being executed.
Evaluate Necessity:
Minimize Risk:
Notify Your Team:
Package: Example Package 100x-client
Socket’s threat detection system flags packages with install scripts by analyzing the code for patterns associated with install scripts. This includes detecting the use of certain functions, file operations, and network requests that are commonly found in install scripts.