1-minute read of a 4 min report

Stolen npm Account Backdoored More Than 140 Mastra Packages

By

1-minute read

What a defender needs to know

An attacker used a compromised npm publisher account to add easy-day-js to more than 140 Mastra packages on June 17. Microsoft attributed the operation with high confidence to Sapphire Sleet. A clean bait release of easy-day-js appeared first; a later version added an obfuscated postinstall script. Mastra’s dependency range caused fresh installs to select the weaponized version.

The script ran during npm install, before application code imported Mastra. It disabled TLS verification, contacted attacker infrastructure and launched a detached Node.js payload. Microsoft found cross-platform persistence and collection features, plus later Windows activity involving a PowerShell backdoor and SYSTEM-level persistence. StepSecurity confirmed the initial network request in a controlled GitHub Actions run and blocked it before the second stage arrived.

Check lockfiles, caches and install records for affected Mastra versions and [email protected]. Correlate that exposure with Microsoft’s file, process and network indicators. If the script may have run, isolate the host and rotate every credential available to the install process.

Future builds should reject unexplained publisher or provenance changes, pin dependency resolution and separate installation from jobs that hold deployment secrets. Restrict outbound access during install steps and allow lifecycle scripts only when the build has a documented need for them.

Verify that the artifact, publisher and dependency graph match the approved record and that installation finishes without deployment credentials or unexplained network connections.

Primary sources