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
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