Mastra npm Supply Chain Attack Analysis
Score: 10/10

Mastra npm Supply Chain Attack Analysis

A threat actor compromised a Mastra maintainer account to poison 140+ npm packages with a malicious dependency used for cross-platform backdoors and credential exfiltration.

Executive Summary

In June 2026, Microsoft and other researchers identified a large-scale supply chain attack targeting the Mastra ecosystem on the npm registry. An attacker, using the handle 'sergey2016', compromised a maintainer account to inject a malicious dependency, 'easy-day-js', into over 140 legitimate packages. This dependency utilized npm postinstall hooks to execute an obfuscated dropper, which subsequently downloaded a sophisticated cross-platform backdoor.

The attack chain began with the publication of a 'clean' bait version of easy-day-js, followed by a weaponized update. When developers or CI/CD pipelines ran 'npm install', the malicious script disabled TLS verification, established persistence, and connected to attacker-controlled C2 infrastructure. The second-stage payload targeted sensitive data, including browser history and cryptocurrency wallet extensions, while enabling arbitrary remote task execution via shell or Node.js.

This incident highlights the critical risk of transitive dependency trust and the limitations of standard security tools like 'npm audit'. Organizations are urged to review dependency trees for affected Mastra versions, audit CI/CD logs for outbound connections to raw IPs, and rotate any credentials or tokens present on systems where the compromised packages were installed.

Key Details

Threat Name

Mastra npm supply chain compromise

Affects

node-ipc, XZ Utils 5.6.0, XZ Utils 5.6.1

Adversary

sergey2016

Malware/Tools

easy-day-js, setup.cjs, protocal.cjs, Crypto Clipper

Report Score

10out of 10
Quality Score
Excellent
IOC Quality10
TTP Details10
Detection Guidance9
Enterprise Relevance10
Clarity & Structure9
Technical Depth10

Sources