Malicious code in anhn-cli (npm)
The npm package anhn-cli contained malicious obfuscated code that executes arbitrary payloads fetched dynamically from Ethereum blockchain transactions. The payload runs automatically whenever the package is required or the CLI is invoked, allowing the attacker to execute arbitrary code on affected systems.
- Disclosed
- Last updated
- Blast radius
- Any developer or system that installed or required the anhn-cli package
- Ecosystems
- Attack vectors
- Affected entities
- anhn-clinpm package containing malicious code in bin/install/install.js
The npm package anhn-cli was found to contain malicious code in bin/install/install.js. The malicious payload is a heavily obfuscated immediately-invoked function expression (IIFE) using obfuscator.io-style string array rotation with arithmetic index decoding.
The attack mechanism queries public Ethereum RPCs and etherscan.io to retrieve transactions from a hardcoded sender address (0xa322E5f3...). The transaction's to field is decoded as an IPv4 address, from which an XOR-encrypted payload is fetched and executed via eval() and a detached Node.js process spawned with spawn('node', ['-e',...], {detached:true}).unref().
Since the package's main entry point (bin/index.js) unconditionally requires ./install/install, the malicious code executes automatically whenever the package is required or the CLI is invoked. The attacker maintains control over the fetched payload by publishing new Ethereum transactions from the sender address, with no version pinning, signature verification, or static destination host.
This incident was identified and credited to the OpenSSF's malicious-packages repository.
Indicators of compromise
- Packages
- anhn-cli
- Domains
- etherscan.io
Remediation
- Immediately uninstall anhn-cli from all systems and development environments
- Audit systems that had anhn-cli installed for signs of compromise or unauthorized activity
- Review npm package dependencies to ensure no other packages depend on anhn-cli
- Use npm audit to check for any related malicious packages
- Consider implementing package integrity verification and allowlisting for critical dependencies
Sources
- GitHub Advisory GHSA-fwrc-9gjh-wr72 · GitHub Advisory Database
Cite this entry
"Malicious code in anhn-cli (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 19, 2026; last updated August 19, 2026. https://supplychainattack.org/incident/malicious-code-in-anhn-cli-npm-1oc9ky
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- containedcritical
Malicious code in 3-buildsight-web (npm)
The npm package 3-buildsight-web contains malicious code that fetches and executes arbitrary JavaScript from a remote Bitbucket URL on module load, granting full page privileges to an unverified third party.
npmCompromised package - resolvedcritical
Malicious code in @usaa-grp-personal-profile/personal-profile-common (npm)
Malicious package @usaa-grp-personal-profile/personal-profile-common version 999.0.0 published to public npm as a dependency-confusion attack targeting an organization's internal registry. The package contains preinstall and postinstall hooks that exfiltrate hostname, username, and working directory to an attacker-controlled OAST endpoint on every install.
npmDependency confusionCompromised package - resolvedcritical
Malicious code in create-coin (npm)
create-coin@20.1.1 on npm contained malicious postinstall code that collected sensitive environment variables, credentials, and host reconnaissance data. The package impersonated an esbuild platform build and exfiltrated data to a hardcoded endpoint.
npmCompromised packageTyposquatting - resolvedcritical
Malicious code in @syncraft-labs/vue (npm)
The npm package @syncraft-labs/vue version 0.4.1 contained malicious obfuscated code in its ESM build that implements a blockchain-hosted C2 dropper (EtherHiding pattern), enabling remote code execution on any consumer importing the package.
npmCompromised package