Skip to content
OTFotf
All posts

144 Mastra npm packages compromised in software supply chain attack

D
DaveAuthor
8 min read
144 Mastra npm packages compromised in software supply chain attack

Mastra npm Packages Compromised: Inside the easy-day-js Supply Chain Attack Impacting 144 Packages

The compromise of 144 Mastra npm packages marks one of the largest and fastest supply chain attacks on JavaScript AI frameworks to date. Known as the “easy-day-js” incident, this breach exploited a single hijacked contributor account and triggered a chain reaction placing countless downstream projects at risk. When a trusted namespace loses control, the surface area is vast: AI developers, enterprise web teams, and automation workflows could have all been exposed. Security teams, maintainers, and JavaScript architects must dissect not just how this happened, but what it means for shipping secure code in public package ecosystems.

What happened in the Mastra npm packages compromise?

The Mastra npm packages compromise is a targeted software supply chain attack in which 144 npm packages, all under the @mastra namespace, were compromised following the takeover of a contributor account. Security researchers including JFrog, SafeDep, Socket, and StepSecurity have identified and tracked this incident, providing public details and mitigation steps.

The central attack vector was the hijacking of a legitimate npm account, known as ehindero. With access to this single account, the attacker was able to mass-publish malicious versions of nearly every major Mastra package in rapid succession. There was no need for a complex zero-day or new exploit—abuse of contributor credentials was enough.

Researchers quickly flagged the event and codenamed it “easy-day-js.” All findings converge on one key fact: the attacker’s access to an authentic maintainer account enabled undetected malicious code publication across a key AI app framework’s entire module set.

For teams building with the Mastra framework or tracking npm supply chain threats, this is the critical detail: one breached credential can put an entire ecosystem at risk, outpacing most traditional scanning strategies.

npm supply chain breach stemming from one hijacked contributor account.

How does the easy-day-js attack exploit the npm ecosystem?

The easy-day-js incident is a textbook example of a software supply chain attack in the npm ecosystem—it weaponizes the trust developers place in open-source maintainers.

Here’s the core mechanics:

  • The attacker gained control of a legitimate npm contributor account (ehindero), which already had publish rights to the @mastra namespace—a collection of AI-focused JavaScript/TypeScript packages.
  • With control of this account, the attacker could publish new versions of any or all packages in the namespace, without tripping any npm registry alarms or requiring elevated review.
  • In rapid succession, 144 compromised packages were released under versions that would appear routine to most dependency managers and automated CI/CD systems.
  • These malicious versions could include data exfiltration backdoors, dependency confusion modules, or persistent hooks—payload specifics may vary, but the mode of compromise is the key risk.
  • Downstream: when a developer or automated build step ran npm install @mastra/some-package, they risked pulling in the attacker’s payload.

Technically, the root failure is npm’s dependence on maintainer credential integrity. Once a contributor account is compromised, the registry cannot inherently distinguish between legitimate and malicious intent from that account.

Mitigations like 2FA, credential auditing, and requiring multiple publisher approvals are best practices, but adoption is not universal; the Mastra incident surfaces that gap. None of these mechanisms are foolproof if contributors aren’t vigilant or if processes are bypassed for perceived convenience.

What makes supply chain attacks so damaging in npm is the speed and breadth: 144 separate packages, multiplied across hundreds or thousands of projects in which each is used. As the chain expands, so do the possible victims.

Practical takeaway: credential hygiene is the most critical line of defense, but registry-wide improvements—automated anomaly detection, mandatory 2FA, downstream alerts—are necessary to make these attacks harder to execute silently.

See also: Understanding Software Supply Chain Attacks in JavaScript

11 production screens. Auth, DB, Stripe — all wired.

The SaaS Dashboard Kit ships everything already connected. No Vercel config, no Supabase account. Live demo at saas.otf-kit.dev.

See the live demo

Which Mastra packages were implicated and what is the impact?

A total of 144 npm packages bearing the @mastra/* prefix were compromised in the easy-day-js attack. The Mastra namespace is widely adopted for JavaScript and TypeScript libraries dedicated to artificial intelligence application construction. Popular among both open-source tinkerers and production AI teams, these packages often serve as foundational dependencies—core building blocks in larger project stacks.

Package types include:

  • Core framework modules (@mastra/core, @mastra/ai)
  • Utility libraries (@mastra/utils, @mastra/data)
  • Model adapters, middleware, and plugin scaffolding
  • Specialized TypeScript interfaces for data, inference, and pipeline orchestration

Impacts cascade outward: any downstream project with direct or transitive dependencies on compromised Mastra packages was at risk of importing, building, or shipping malicious code.

Key risks:

  • Security: Attackers could siphon developer credentials, API keys, or user data from processes running compromised code.
  • Stability: Even if the payload is non-destructive, unexpected changes can break builds, introduce subtle bugs, or degrade performance.
  • Trust: When a foundational vendor is compromised, it erodes ecosystem reliability and forces audits across a wide surface area.

As of the incident report, the exact exploit payloads and real-world exploitation data have not all been published, but the consensus from JFrog and others is that any project pulling these versions should consider itself exposed.

Takeaway: when the trust boundary is crossed, every install, CI/CD run, and production deployment is a potential breach vector. The real cost is not just patching, but recertifying the integrity of every dependent artifact.

How can developers protect themselves from npm package supply chain attacks?

Developers cannot prevent attackers from targeting popular packages, but there are immediate, concrete steps to reduce risk and contain damage when incidents like easy-day-js occur.

The priority list:

  1. Audit Dependencies Regularly

    • Examine every direct and transitive dependency. After the Mastra incident, run a full audit:
      npm audit --all
      # for a flat tree:
      npm ls --all | grep mastra
    • Identify all usages of compromised namespaces and flag any unvetted or recently updated components.
  2. Verify Package Maintainers and Version History

    • Audit the list of maintainers on critical packages.
    • Look for anomalies in version history (sudden bursts of releases, version misalignment, or new maintainers).
  3. Use Automated Vulnerability Scanning Tools

    • Tools like JFrog Xray, SafeDep, or Socket provide real-time detection for compromised or anomalous packages.
    • Integrate these scanners into your CI pipelines:
      # Example workflow step (pseudocode)
      - uses: jfrog/setup-jfrog-cli@v1
      - run: jfrog xr scan --watches="critical"
    • Monitor advisories from npm, JFrog, and other security teams.
  4. Update or Replace Compromised Packages Promptly

    • If using a compromised Mastra package, remove or downgrade as fast as possible.
      npm uninstall @mastra/<package>
      # or pin to a known safe version
      npm install @mastra/<package>@1.2.3
    • Follow upstream advisories—restored packages may require scrutiny before redeployment.
  5. Enforce Strong Account Security for Publishers

    • Require 2FA for all npm publisher and contributor accounts.
    • Rotate credentials after any incident, regardless of perceived exposure.
    • Consider publisher approval workflows for key modules.
  6. Incorporate Build-Time Security Checks

    • Block new or unverified package versions at build time via centrally-managed lockfiles, package whitelists, or artifact validation rules.
  7. Adopt General npm Security Hygiene

    • Use package-lock.json or npm ci to lock dependency graphs.
    • Monitor for deprecated or unmaintained dependencies.
    • Stay current on npm security advisories and incident reports.

For a deeper checklist, see: Top npm Security Best Practices for Developers

Practical mitigation is repeatable: detect, isolate, and remediate at both the dependency and CI/publisher levels. Above all, act on advisories—time lost is attack surface.

the npm dependency flow from publisher, through registry, to developer → where a hijacked

What are the lessons from the Mastra easy-day-js incident for open source security?

The Mastra incident exposes urgent, systemic lessons for open-source supply chain security across all package ecosystems.

Securing maintainer accounts is non-negotiable. The breach of a single contributor account, with unchecked publish permissions, infected 144 packages in one move. No registry control or lightweight automation can defend against rogue publisher credentials. Community norm must shift to universal 2FA, frequent audits, and organizational oversight of key namespaces—especially those foundational to AI and automation stacks.

Scrutiny of AI and framework ecosystems must increase. As Mastra demonstrates, high-impact, high-volume codebases attract persistent attackers. Any library serving as a platform multiplier or “framework for frameworks” raises the stakes for potential supply chain attacks.

Detection and mitigation are a team sport. This attack was identified and mapped out swiftly by JFrog, SafeDep, Socket, and StepSecurity sharing intelligence. No single vendor or tool will catch all techniques in time—collaboration accelerates response, clarity, and best practice dissemination.

The need for ecosystem-wide tooling and awareness is critical. Registry-side improvements (mandatory 2FA for all publishers, anomaly-based release flagging, admin-require locks), and downstream intelligence (real-time scanner alerts, dependency graph analysis) are overdue. The time for optional adoption is over.

Key lesson: if your code or business depends on open-source, so does your security posture. Integrate supply chain defense into both project and organizational policy.

For further reading: How to Protect Your npm Account From Hijacking

Closing: the future of supply chain defense in open source JavaScript

The easy-day-js compromise of Mastra’s npm packages is a warning shot for every team building with public dependencies—AI-focused or otherwise. Today’s attacks use speed, scale, and overlooked credential hygiene; tomorrow’s will escalate in complexity. Developers must move beyond reactive fire drills to bake verification, publisher vetting, and dependency auditing into every workflow. Vendors and registries must harden defaults before the next big namespace goes dark. In the end, open source survives on trust—but trust must be engineered, not assumed.

Stay vigilant, automate your checks, and treat every new dependency and update as a potential review event. The cost of complacency in the JavaScript ecosystem is only going up.

ai-toolsbackendannouncement
OTF SaaS Dashboard Kit

Ship the product, not the setup.

  • 11 production screens — auth, billing, team, analytics, settings
  • Real Postgres + Stripe + Better Auth, all wired on day 1
  • CLAUDE.md pre-tuned so your agent extends instead of regenerates