Malicious npm Packages Abuse Postinstall Scripts to Steal Ethereum Private Keys and Mnemonic Phrases

A recently discovered software supply chain attack has targeted blockchain developers by deploying eleven malicious npm packages designed to steal cryptocurrency wallet credentials and compromise development infrastructure.

The campaign highlights a growing trend of threat actors exploiting open-source ecosystems to target the financial assets of Web3 projects and cloud-native environments.

Cyfirma Research recently identified a coordinated operation involving npm packages that masqueraded as legitimate development tools.

These malicious packages collectively amassed over 2.7 million downloads, significantly amplifying the attack’s potential reach and impact.

By mimicking trusted names and employing typosquatting techniques, the threat actors deceived developers into incorporating compromised code into their workflows.

npm Packages Abuse Postinstall Scripts

Meanwhile, the Coinbase Wallet Utils functioned as an information stealer, conducting host reconnaissance and exfiltrating sensitive environment data to attacker-controlled infrastructure.

The second cluster featured the widely distributed moralis-sdk package, which accumulated the vast majority of the campaign’s downloads. This package contained a heavily obfuscated post-install script that operated as a downloader.

Upon installation, the script initiated a multi-stage infection chain to retrieve and execute remotely hosted payloads, thereby establishing a foothold within the compromised systems.

npm Packages Abuse Postinstall Scripts (Source: cyfirma)
npm Packages Abuse Postinstall Scripts (Source: cyfirma)

The third cluster involved a long-running typosquatting campaign utilizing packages such as Ganach, Solidity, and Stelar-sdk.

These packages leveraged blockchain-hosted command-and-control infrastructure to fetch malware delivery servers and deploy platform-specific payloads dynamically.

Furthermore, an npm user known as ethcompat published five additional malicious packages, including hardhat-deploy-utils and ethers-compat, which collectively gathered over 2,200 downloads.

These packages were specifically tailored to harvest deployment credentials, SSH keys, and wallet secrets from developer environments.

npm Packages Abuse Postinstall Scripts (Source: cyfirma)
npm Packages Abuse Postinstall Scripts (Source: cyfirma)

The primary mechanism of compromise across these packages involved the abuse of npm post-installation scripts.

Threat actors leveraged these lifecycle hooks to automatically execute malicious code as soon as the package was installed, without requiring any further developer action.

The discovery of this massive campaign reinforces the critical need for continuous software supply chain monitoring and package verification.

Organizations developing cryptocurrency applications or decentralized finance platforms must implement strict security controls to evaluate the integrity of publicly available npm packages before integration.

Security teams are advised to review dependency trees for suspicious packages and monitor development environments for unauthorized data exfiltration, Cyfirma said.

Developers can protect themselves by pinning dependencies to verified versions and utilizing software composition analysis tools to identify known vulnerabilities or malicious code.

Furthermore, avoiding reliance on generic package descriptions and thoroughly scrutinizing the authors and download metrics of new dependencies can help prevent accidental installation of typosquatting or impersonation of libraries.

As open-source ecosystems remain attractive targets for financially motivated adversaries, adopting a defense-in-depth strategy is essential to safeguarding critical infrastructure and sensitive digital assets against sophisticated supply-chain attacks.

Indicators of Compromise

TypeRemarks
53b91117db931d3acbbfd15aa8400bb6691e023d SHA1 ethers-jss package archive
d94a2444268b339dfda2615f7800322fb318e0a484414bb17016cfcd5eb07c44 SHA256 ethers-jss package archive
63154cd9c79f9d14eb9be6c4efc2a778d31646ec SHA1 coinbase-wallet-utils package archive

Note: IP addresses and domains are intentionally defanged (e.g., [.]) to prevent accidental resolution or hyperlinking. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

Follow us on Google News , LinkedIn and X to Get More Instant Updates. Set Cyberpress as a Preferred Source in Google.

Varshini
Varshini
Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Trending News

Related Stories