Back to all lessons
Awareness Lessons
6 months ago

Hijacked npm Contributor Account Poisons 144 Mastra Packages

Written by AI from the linked story. Not reviewed by an editor. How this works

Attackers compromised a contributor's npm account to publish malicious versions of the 'easy-day-js' library, which was then used as a dropper to deliver a cryptocurrency-stealing infostealer across 144 packages in the Mastra namespace. The root issue is a combination of weak account security on a trusted contributor account and insufficient integrity verification for third-party dependencies. This attack demonstrates how a single compromised identity in a package ecosystem can cascade into a widespread supply chain compromise affecting all downstream consumers. It matters because developers and organizations trusting these packages unknowingly execute malicious code, potentially exposing wallets, credentials, and sensitive data.

Tactical Insight

Immediate actions

  • Audit all dependencies in your projects for the compromised 'easy-day-js' package and remove or pin to a known-good version immediately.
  • Enforce multi-factor authentication (MFA) on all npm contributor and maintainer accounts to prevent account hijacking.
  • Run a software composition analysis (SCA) scan across your codebase to identify any exposure to the affected Mastra namespace packages.

Long-term improvements

  • Implement a dependency review and approval process that verifies package integrity (e.g., checksums, provenance attestation) before any new or updated dependency is introduced.
  • Adopt a private package registry or mirror to control which versions of open-source packages are permitted within your environment.
  • Apply the principle of least privilege to package publishing rights, ensuring only designated maintainers can publish to critical namespaces.

Detection measures

  • Monitor npm audit logs and dependency manifests for unexpected version changes or newly introduced packages using automated SCA tooling in CI/CD pipelines.
  • Set up runtime behavioral monitoring to detect anomalous outbound network connections or unexpected process execution that may indicate infostealer activity.
  • Subscribe to security advisories from npm, OSV, and relevant threat intelligence feeds to receive early warnings about compromised packages.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.