NPM · JUNE 2026 · CONFIRMED

Mastra AI npm Supply Chain Attack: What Happened

On June 17, 2026, more than 140 packages across the mastra and @mastra npm scopes were compromised after an attacker hijacked a maintainer account with publish rights across the ecosystem. The attacker used that access to introduce easy-day-js, a malicious typosquat of the popular dayjs library, into the poisoned releases. Microsoft assessed with high confidence that the campaign was the work of Sapphire Sleet, a North Korean state-sponsored threat actor active since at least March 2020, marking one of the clearest state-actor attributions yet for an npm supply chain compromise.

What happened

The compromise originated with the takeover of an npm maintainer account, publicly identified in reporting as belonging to a contributor with the username ehindero, which held publish rights across the Mastra AI ecosystem. The attacker used that access to publish poisoned versions of over 140 packages that pulled in a new, malicious dependency named easy-day-js, deliberately named to resemble the widely used and trusted dayjs date library.

Once installed, easy-day-js triggered a postinstall hook that ran an obfuscated dropper script, disabled the machine's TLS certificate verification to make it easier to talk to attacker infrastructure without being blocked, contacted a command-and-control server, downloaded a second-stage payload, and executed it as a hidden background process. Because the trigger was a postinstall hook rather than something requiring the package to be imported in application code, any developer workstation or CI/CD pipeline that simply ran an install or update during the compromise window was potentially exposed, regardless of whether the affected package was ever actually used. The compromised versions have since been removed and the attacker's publish access to the @mastra scope was revoked.

How 0Day mitigates this

INSTALL-TIME RISK, NOT JUST IMPORT-TIME RISKThis attack triggered on install, before a single line of the package was ever imported or executed by application code, which means traditional code review of your own codebase would never have caught it. 0Day matches incoming threat signals against every package and version in your dependency graph the moment they're flagged, independent of whether or how the package is actually used in your code, because install-time payloads like this one don't wait for that distinction either.

Read how this differs from scanning for known vulnerabilities in code you actually call, or see the exact, read-only access 0Day needs to do this for an organization.

Sources

Microsoft Security Blog: Inside the Mastra npm Supply Chain Compromise
SecurityWeek: North Korean Hackers Blamed for Mastra npm Supply Chain Attack
The Hacker News: 144 Mastra npm Packages Compromised via Hijacked Contributor Account

Join the 0Day waitlist →

← Back to all incidents