Malicious npm Packages Use PowerShell and VBS Chain to Drop Windows RAT

Threat actors are increasingly targeting the developer ecosystem by exploiting trust in widely used tools. Recently, researchers uncovered a sophisticated campaign using malicious npm packages to deploy a multi-stage Windows Remote Access Trojan (RAT).

The attackers relied on a clever typosquatting tactic, naming their primary payload postcss-minify-selector-parser.

This name closely mimics the legitimate postcss-selector-parser, a foundational component of the JavaScript build ecosystem that boasts over 150 million weekly downloads.

Unlike traditional typosquatting, which relies on simple, single-character errors, this malicious package appears highly plausible during a casual dependency review.

It shares the same keyword space as its legitimate counterpart. It even depends on the real package to avoid raising immediate suspicion.

npm Packages Drop RAT

The attack begins the moment the malicious package is imported into a developer’s project. The package’s entry point immediately calls a seemingly benign configuration file that actually contains a massive AES-256-GCM-Encrypted data blob.

Once decoded, this hidden payload acts as a JavaScript dropper. It writes a malicious PowerShell script directly to the disk and executes it with system execution policies bypassed.

npm Packages Drop RAT (Source: jfrog)
npm Packages Drop RAT (Source: jfrog)

This PowerShell script serves as the second stage, operating as a stealthy downloader. It reaches out to a deceptive domain, nvidiadriver[.]net, to retrieve a ZIP archive containing the next phase of the attack.

By naming the archive winPatch.zip and extracting it into the %TEMP% directory, the attackers attempt to blend in with routine Windows update processes.

str0825library = "cmd.exe /c tar -xf ""<currentDir>\dll.zip"" -C ""<currentDir>"""
ssh.Run str0825library, 0, -1

cmd0825main = "cmd /c chost.exe loader.py"
ssh.Run cmd0825main, 0, False

Once embedded in the host system, the RAT exhibits extensive profiling and data exfiltration capabilities. It thoroughly inspects the environment to ensure security researchers are not analyzing it.

The command.pyd module executes Windows Management Instrumentation (WMI) queries and cross-references MAC addresses to detect virtual machines or sandboxing tools like VMware, VirtualBox, or QEMU.

If the environment is deemed safe, the malware establishes registry persistence under the current user run keys and awaits instructions, jfrog said.

The most alarming feature of this RAT is its focus on browser-based data theft. A dedicated module targets Google Chrome, specifically seeking out the browser’s Local State and Login Data databases.

Using Windows DPAPI and advanced decryption methods including AES-GCM and ChaCha20-Poly1305 the malware aggressively bypasses newer app-bound encryption logic to extract saved credentials and browser extensions.

The stolen data is temporarily stored in an in-memory archive before being tunneled back to the attackers through the existing encrypted C2 packet protocol.

Indicators of Compromise

Indicator TypeIndicatorContext / Description
URLhxxp[:]//nvidiadriver[.]net/verv1432/winpatch-xd7d[.]winInitial Windows bundle download location
URLhxxp[:]//95[.]216[.]92[.]207:8080Active Command and Control (C2) server
Domainnvidiadriver[.]netDeceptive domain hosting the payload bundle

Note: IP addresses and domains are intentionally defanged (e.g., [.]) to prevent accidental resolution or hyperlinking. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

Follow us on Google News , LinkedIn and X to Get More Instant Updates. Set Cyberpress as a Preferred Source in Google.

Varshini
Varshini
Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Trending News

Related Stories