ReversingLabs researchers have identified more than a dozen malicious packages on the npm public repository since the beginning of August, including multistage, malicious packages that placed Luna Grabber, an open-source information-stealing malware, on infected systems. In a replay of an attack uncovered two years ago, the malicious packages imitated the legitimate package noblox.js, a Node.js Roblox API wrapper used to write scripts that interact with the Roblox gaming platform.
This malicious campaign started at the beginning of August, with the first malicious package of interest published on August 1. ReversingLabs researchers have identified additional malicious packages: noblox.js-ssh and noblox.js-secure. The package noblox.js-ssh has been reported to the npm maintainers. The noblox.js-secure has subsequently been removed from npm, likely by the author.
Roblox developers targeted
The malicious packages ReversingLabs discovered reproduce code from the legitimate noblox.js package but add malicious, information-stealing functions.
Similarities to 2021 campaign
This is not the first time malicious actors have targeted users of noblox.js. Two years ago, Sonatype uncovered a campaign that distributed malicious npm packages that also typo-squatted on the noblox.js package. The malicious packages found by Sonatype researchers also reproduced code from the legitimate package, but included a malicious code in the post-installation script. Once the package was installed, that malicious script was executed, delivering ransomware to the unsuspecting developers. That campaign attracted media attention, including from The Register.
The broad outlines of the current campaign are similar to the one Sonatype discovered. However, the malicious payload in the campaign discovered by ReversingLabs is different: a PyInstaller-compiled executable that delivers Luna Grabber, open-source malware designed to steal information from the user's local web browser, Discord application, and more.
It is not unusual for ReversingLabs researchers to find this type of multistage malware on public repositories. Multistage malicious packages are found regularly on PyPI, ranging from sophisticated to more “script-kiddie”-like packages. It is less common to find multistage malicious packages such as this on npm.
Researchers first stumbled on this campaign during routine monitoring of the npm public repository and scanning suspicious packages with the ReversingLabs Software Supply Chain Security platform. The malicious package noblox.js-vps was the first to catch our attention because its name was clearly typosquatting on the noblox.js package and trying to pass itself off as a legitimate package.
Upon further inspection, the package displayed a number of suspicious behaviors, as indicated in the table below. Those included executing commands in the command line, enumerating user and file information from the local host, and adding a function to listen for a specific event, among others. As we have noted before, malicious packages on public, open-source repositories often contain red flags such as these that warrant further inspection before the package is downloaded and used.
Figure 1: Behavior indicators of noblox.js-vps
A postinstall switcheroo
With malicious campaigns that target the software supply chain, the difference between sophisticated and unsophisticated attacks often comes down to the level of effort the malicious actors make to disguise their attack and make their malicious packages look legitimate.
In the case of noblox-js-vps, the malicious actors expended considerable effort to make their package look trustworthy in order to fool would-be Roblox developers. As noted above, the code found inside the package belonged to the legitimate noblox.js package it was mimicking. As a result, its npm page was almost identical to the official noblox.js GitHub page. The noblox.js-vps package was removed from npm shortly after our discovery. However, a screenshot of the similar npm page of another malicious package in the campaign is shown in Figure 2.
Figure 2: Attackers made noblox.js-ssh’s npm website page look legitimate.
The only difference between a legitimate package and a malicious one was that a malicious payload was put inside a separate file, postinstall.js, that is called after installation of the main npm package is complete.
This was a clever move on the malicious actors' part. That's because the original noblox.js package also contains a postinstall.js script that displays a thank-you and some useful information to the users who installed it. The malicious version, on the other hand, checks to see if the package was installed on a Windows machine, and if positive, it downloads a second-stage malicious script from Discord CDN and runs it. If not, the user is presented with an error message.
A close examination of this file showed the gradual evolution of the malicious noblox-js-vps package. For example, the first version of the package, 4.14.0, contained a postinstall.js script that was a work in progress, without any malicious code inside.
The next version of the package, 4.15.0, saw the postinstall.js file checking to see if the package was installed on a Windows machine and, if it was, harvesting the Windows username to the provided Discord webhook.
All subsequent versions of the file downloaded the second-stage malicious script from the Discord CDN. Also, while the first few versions of the noblox.js-vps package made no effort to obfuscate the content of the postinstall.js script, subsequent versions obfuscated parts of the postinstall.js script.
Figure 3: A malicious script, postinstall.js, was found inside noblox.js-vps.
Luna Grabber: Plug and play malware
While each iteration of the second-stage script was a bit different from the version before it, all of the second-stage scripts we observed downloaded the same third-stage executable payload that was later run.
Unfortunately, our attempts to fetch the third-stage script from the second-stage payload script connected with noblox.js-vps version 4.23.0 failed. As a result, we cannot confirm that it was the same executable fetched by the second-stage scripts used by other packages in the campaign. However, since it is connected with other packages, the research team believes it was fetching the same executable.
With further research using ReversingLabs' Titanium Platform, the downloaded executable was found to be a PyInstaller-compiled executable serving Luna Grabber. Identifying this malware was possible after identifying a script inside the malicious executable. The content of that file matched a file found on Luna Grabber’s GitHub page as luna.py and holds all the logic of Luna Grabber.
Luna Grabber is malware made to steal information from installed web browsers and the Discord application, as well as local system information and so on. It also has features that are very common with malicious software such as the ability to detect if it is being run in a virtual environment as well as a self-destruct feature.
Luna Grabber is very customizable and has detailed instructions on its GitHub page on how to compile a malicious executable. Something similar was observed by the ReversingLabs research team with TurkoRat, customizable malicious software that we detected lurking on GitHub in May.
The TurkoRat open-source malware provided would-be malicious actors with an option to bundle its malicious code inside of an executable file that could later be used as bait in phishing or software supply chain campaigns intended for developers.
However, Luna Grabber’s author made the whole process of packaging the malware even easier than with TurkoRat by creating a special application just for building and configuring the malicious executable with simple check-box options such as "Add to Startup," "Ping" (with a field to provide an IP address), and "Injection," as well as options to collect "Wifi Info," "Browser Info," "Discord Info" and more.
The malicious actor behind noblox.js-vps took full advantage of this user-friendly evolution, using the Luna Grabber builder (Figure 4) to create the executable later served by the malicious packages.
Figure 4: Luna Grabber builder, taken from its official GitHub page
As it turns out, the malicious actor behind noblox.js-vps opted for stealing only system information from victims, since all other options are marked as false in the configuration part of the file.
Figure 5: Configuration part of Luna Grabber
Similar patterns in other malicious packages
Additional packages connected with this campaign, noblox.js-ssh and noblox.js-secure, followed the same pattern: Malicious code inside of the postinstall.js script downloaded a second-stage payload script that then downloaded the third stage — possibly the same executable already analyzed.
Unfortunately, at the time of the research report, the third stage wasn’t retrievable, and even fetching the second stage from package noblox.js-ssh version 4.2.5 failed.
Fortunately for developers, the time frame during which this campaign was active was very short, and there wasn’t a significant impact measured in downloads of the malicious packages. The combined traffic across the three malicious packages was under 1,000 downloads, with noblox.js-vps being the most frequented, with 585 downloads. That is a small fraction of other, recent malicious packages.
Indicators of Compromise (IoCs)
The following IOCs were collected as part of ReversingLabs' investigation of the noblox.js-vps software supply chain campaign.
Malicious PyInstaller compiled executable:
As we observed, this latest campaign targeting users of the Roblox platform has many similarities to one identified two years ago, with malicious npm packages mimicking noblox.js, a popular npm package with hundreds of thousands of downloads, while delivering ransomware. As in that campaign, the targets of these new, malicious packages were Roblox users and developers on the lookout for useful scripts to interact with the Roblox website. And, as with that campaign, this one had a limited impact, with just 963 downloads of three different malicious packages. (The previous malicious noblox campaign identified by Sonatype had just 386 downloads.)
As for the larger significance of this campaign: It highlights yet again the trend of malicious actors using typosquatting as a technique to fool developers into downloading malicious code under the guise of similarly named, legitimate packages. This is a technique the research team has observed many times in recent months, including the IconBurst malicious npm campaign spotted in July 2022 and the more recent Brainleeches campaign on npm, which we wrote about in July 2023.
Multistage, malicious packages such as those that made up this campaign are common on open-source platforms such as Python Package Index (PyPI). However, they are less common on npm, which hosted this campaign. That may signal a new trend, or not. It is hard to tell at this stage if this is behavior we should expect to see more of on npm.
Also worth noting is the use of the Luna Grabber "turnkey" open-source malware to generate malicious executables that act as bait in phishing and supply chain attacks, gathering sensitive information from targeted developers. This was similar to the recently disclosed TurkoRat attack in May, which also saw malicious actors tapping an open-source malware application to create the final stage malware delivered to victims.
Even though the impact of noblox.js-vps and other malicious packages in this campaign wasn’t high, it is a reminder to security and software development teams that threats lurk consistently in open-source repositories, making choosing which package to include in the development process critical.
Get up to speed on key trends and understand the landscape with The State of Software Supply Chain Security 2024. Plus: Learn about ReversingLabs Spectra Assure for software supply chain security.
- Update your understanding: Buyer's Guide for Software Supply Chain Security
- Join the Webinar: Why you need to upgrade your AppSec for the new era
- Get the report and take action: The State of Supply Chain Security 2024
- Join the discussion: State of Software Supply Chain Security Webinar
- See Gartner's guidance on managing software supply chain risk