Skip to content

Back to the catalog

Socket: 141 Mastra npm Packages Compromised via Typosquatted Dependency
socket.devwriteup

Socket: 141 Mastra npm Packages Compromised via Typosquatted Dependency

Socket's research team documents a supply chain attack in which npm account "ehindero" mass-published 141 malicious versions of @mastra/* packages (including @mastra/core, 918K weekly downloads) that were byte-identical to legitimate code but added a single new dependency: the typosquatted package easy-day-js. That package's postinstall hook (setup.cjs) disables TLS validation, fetches a second-stage cross-platform Node.js implant (protocal.cjs) that installs OS-specific persistence (Windows Run key, macOS LaunchAgent, Linux systemd unit disguised as Node/NVM tooling), inventories 166 cryptocurrency wallet browser extensions, steals Chrome/Edge/Brave history, and accepts arbitrary remote tasking (Node/Shell runners) from a hardcoded C2 over a custom ICAP-style protocol. The writeup includes full IOCs, SHA-256 hashes, and remediation guidance (rotate npm/CI/SSH credentials, treat affected hosts as compromised, disable install scripts).

TL;DR Compromised npm account published 141 @mastra/* packages that pull in a typosquatted "easy-day-js" dependency with a postinstall hook dropping a cross-platform crypto-wallet-inventorying, history-stealing, persistent C2 implant.
Document

What it is

A supply chain attack against the Mastra npm scope. On 2026-06-17, between ~01:15 and 02:36 UTC, a single human npm account (ehindero) mass-published malicious versions of 141 @mastra/* packages — normally released only by the project's GitHub Actions CI. The @mastra/* code itself is byte-for-byte identical to the last legitimate build; the only functional manifest change is one added dependency, easy-day-js, a typosquat of dayjs. @mastra/core alone sees ~918K weekly downloads.

How it works

The malicious logic lives entirely on the transitive dependency, so npm install of any compromised package executes it before app code is imported.

  • easy-day-js@1.11.21 (published a day earlier, 2026-06-16, by a separate account sergey2016) is a clean copy of dayjs with no hook — used to build benign history.
  • easy-day-js@1.11.22 adds "postinstall": "node setup.cjs --no-warnings".

Stage 1 (setup.cjs, obfuscated via obfuscator.io) sets NODE_TLS_REJECT_UNAUTHORIZED='0', beacons the victim path/campaign marker to temp files, fetches stage 2 from C2 23.254.164.92:8000, writes it to a random temp filename, spawns it detached (passing exfil target 23.254.164.123:443), then self-deletes.

Stage 2 (protocal.cjs, ~41 KB) is a cross-platform tasking client, not a fire-and-forget stealer: it installs login persistence (Windows/macOS/Linux) and beacons back to run whatever follow-on code the operator returns. It steals browser history and stored data from 160+ crypto wallet extensions.

Preconditions / Affected

Any workstation, CI runner, or build environment that ran npm install pulling an affected @mastra/* version in the exposure window. Note the article cites 141 affected packages though the title says 140+; not every package in the scope was hit.

What to do

Treat any host or CI runner that ran the install as compromised:

  • Remove the affected versions, delete node_modules, reinstall a known-good prior version.
  • Rotate credentials that may have been exposed during install: npm tokens, cloud provider keys, CI/CD secrets, and SSH and Git credentials.

Detection artifacts: temp files .pkg_history and .pkg_logs, connections to 23.254.164.92:8000 and 23.254.164.123:443.

Caveats

Socket flagged the malicious easy-day-js within six minutes of publication and blocks it automatically for its customers. The investigation is ongoing — Socket says it is "still analyzing exact impact" and maintains a live campaign page for the authoritative affected-version list; do not treat any partial list here as complete. The clean-then-weaponize dependency pattern mirrors the recent axios campaign.

Organisations named here

  • easy-day-js

Technologies named here

  • Socket
  • @mastra/* npm packages
  • npm ls easy-day-js
  • @mastra/core
  • node:sqlite
  • easy-day-js
  • node:dns
  • Windows
  • macOS
  • Linux
  • Chrome, Edge, and Brave browsers
  • Cryptocurrency wallet browser extensions
  • npm
  • Node.js
  • dayjs
  • systemd
  • SQLite
  • mastra

Techniques named here

  • Typosquatting
  • Supply chain / dependency injection attack
  • Malicious install/postinstall hook
  • TLS certificate validation bypass
  • Staged payload delivery
  • Detached process execution
  • Anti-forensics / self-deletion
  • Persistence establishment
  • Masquerading
  • C2 tasking / beacon-and-poll
  • Custom ICAP-style exfiltration protocol
  • Cryptocurrency wallet extension inventory theft
  • Browser history theft
  • Host reconnaissance

Threat actors named here

  • ehindero
  • sergey2016
  • easy-day-js
  • protocal.cjs
  • axios campaign