Yesterday, Mastra was hit by a supply chain attack.
A malicious postinstall script that exfiltrated credentials and then self-deleted was added to specific versions of our npm packages.
Most importantly: the incident is over. All relevant package versions are unpublished.
The root cause is that one of our maintainers was compromised.
Between 6:12 PM and 6:37PM PT yesterday, a token associated with their account published 116 malicious NPM packages, almost all in the `@mastra/` namespace.
We became aware of this at 8:45pm PT. We immediately contacted npm as well as trusted third parties (eg @SocketSecurity).
We also began unpublishing, and unpublished 59 packages.
As part of the attack, we lost access to some packages. Around 10:15pm PT, we were able to re-add our accounts to those packages. We began unpublishing the rest. In total, we unpublished 110 packages, and deprecated 6.
By 11:57pm PT, all affected packages were unpublished or deprecated.
At around 1am PT, we also published new, safe versions of each package affected (https://t.co/tWXe6DXtWa), so that installs would resolve
We have always required MFA on NPM for maintainers, but we also allowed (mistakenly) token bypass. Also around 1am PT, we removed token bypass across all packages.
At 2:25am PT, we established contact with the compromised maintainer. He is a current, active Mastra employee. His machine was compromised via a social phishing attack.
A compromised LinkedIn account reached out to him as well as maintainers of other prominent TypeScript open source packages. He was on a call and clicked a suspicious link.
This was the same attack vector as other open-source maintainers have reported (eg https://t.co/Ci2PjDBc65).
Around 4:40am, npm responded to the security ticket we'd filed and confirmed the breach. They unpublished the last 6 affected packages.
For a third-party report on the incident / malware, including a list of package versions affected, and the mechanisms of the RAT: https://t.co/mB7d68Z0JT.
We're continuing to keep reducing scope of sensitive credentials and enhance our use of MFA. Security is an ongoing process of review and hardening.
Thanks for the hugops. Stay safe out there. I'll be here answering questions.
React → https://t.co/a4QDSs9wxd
Next.js → https://t.co/nDDXqUmgw5
@aisdk is more relevant than ever, given the intense model competition landscape. Just today, GLM 5.2, an open model, surpassed Opus 4.8 in our Next.js Evals (https://t.co/aporqgIfIh) 🤯
But the world needs a practical solution for how to build and deploy agents. Just like React needed Next.js to solve the task of building an actual web application. And that's eve.