Fortinet’s security researchers have identified multiple malicious NPM packages containing obfuscated scripts designed to harvest a trove of information from victims’ systems.
On Monday, Fortinet warned of 35 malicious packages in the NPM Registry containing install scripts capable of collecting system and user data and exfiltrating it via a webhook or file-sharing link.
The cybersecurity company has grouped the packages into nine different sets, based on similarities in styles of code and functions, including the targeting of specific sensitive information for exfiltration.
The install scripts within these packages would run pre- or post-install to perform data harvesting, but would also be executed when the NPM package was installed.
The first set of packages includes an obfuscated index.js script capable of stealing Kubernetes configurations, SSH keys, and other sensitive information. System data such as IP address, hostname, and username is targeted as well.
The second set of packages contains an index.js file designed to send an HTTP GET request to a specific URL, to scan for specific files and directories, and to exfiltrate developer data, such as source code and configuration files.
“The targeted files and directories may contain highly valuable intellectual property and sensitive information, such as various application and service credentials. It then archives these files and directories and uploads the resulting archives to an FTP server,” Fortinet explains.
The third and fourth sets have an index.mjs script that relies on a Discord webhook for sensitive data exfiltration, but each has a different style of coding.
The index.js install script in the fifth set of packages uses a webhook to exfiltrate hostnames, usernames, and the home directory contents.
The seventh set relies on an installer.js install script designed not only to exfiltrate sensitive data, but also to disable TLS certificate validation, rendering the connection vulnerable to eavesdropping.
The eighth set was designed to automatically fetch and execute a potentially malicious executable file, while the ninth set of packages gathers system information and exfiltrates it to a Discord webhook.
“End users should watch for packages that employ suspicious install scripts and exercise caution. We will continue hunting for and reporting malicious packages to help users avoid becoming victims,” Fortinet notes.