Malicious npm RAT Poisons AI Tool Scripts for Persistent Code Execution

A sophisticated npm supply-chain campaign has targeted developers linked to Alibaba Group by disguising malicious packages as internal developer tools.

The operation, which remained active for more than three months, used fake package names, layered dependencies, and a cross-platform remote access trojan (RAT) to steal credentials, cloud API keys, and enterprise data.

Researchers discovered the campaign after analyzing lib-mtop, an npm package that initially appeared to be a simple downloader.

The package was first published about three years ago, but new versions appeared in late March 2026. This activity may indicate that its maintainer account was compromised, although a rogue maintainer cannot be ruled out.

The package name is important because it imitates a private package used under Alibaba’s @ali npm scope. This scope is associated with Alibaba’s internal development tooling and packages.

Attackers relied on developers or build environments resolving the expected internal dependency while silently installing additional malicious dependencies.

Fake AI Infostealer Campaign

The threat actors split the malware chain across multiple npm packages, making each component appear harmless when examined in isolation.

Several top-level packages served as empty wrappers for names that resembled private Alibaba-related tools. These packages depended on a shared middle-layer package named smart-config-manager.

That package then loaded two other components: cloud-config-fetcher and local-config-parser. On their own, the packages appeared legitimate.

One downloaded configuration data, while the other parsed local JSON rules and evaluated them through Node.js’s vm module.

However, their combined behavior created a downloader-and-execution chain. The configuration-fetching component retrieved a file from an attacker-controlled GitHub repository and saved it locally as .cloud-preferences.json.

The parser then loaded this file and ran the embedded rules. The malicious code was hidden inside what appeared to be a normal configuration rule.

It used a known Node.js sandbox escape technique to access the host process outside the VM. This allowed the malware to reach Node.js module-loading functions, retrieve a further payload from attacker-controlled infrastructure, and execute it.

The following payload performed system reconnaissance and selected platform-specific actions. On macOS, it modified shell startup files and created a Launch Agent for persistence.

On Windows, it reportedly targeted an Alibaba security application and attempted to replace core application code. On Linux, it downloaded and ran a detached binary before removing the file from disk.

The final malware payload, named aone-cli, was a cross-platform RAT designed for remote control and data theft.

Its functions included shell command execution, file upload and download, host discovery, payload delivery, reverse proxy capabilities, and persistence, socket said.

Indicators of Compromise

IOC TypeIndicatorNotes
Malicious npm packagelib-mtopInitial downloader package and unscoped impersonation of a private @ali package
Malicious npm packageaone-kitLure package

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.

Cut SOC investigation blind spots and contain threats earlier to reduce response costs and business disruption with ANY.RUN. 

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