Malicious code in @openzeppelin-4/contracts (npm)
The npm package @openzeppelin-4/contracts is a typosquatting attack impersonating the legitimate @openzeppelin/contracts library. It contains malicious code that harvests credentials and secrets from the installer's environment and filesystem, then exfiltrates them to an external webhook.
- Disclosed
- Last updated
- Blast radius
- Any developer or CI/CD system that installed @openzeppelin-4/contracts; credential theft affecting AWS, GitHub, NPM, Solana, Sui, Foundry, Kubernetes, Docker, gcloud, and SSH accounts.
- Ecosystems
- Attack vectors
- Affected entities
- @openzeppelin-4/contractsMalicious npm package impersonating @openzeppelin/contracts
The package @openzeppelin-4/contracts was published to npm as a typosquatting attack against the legitimate @openzeppelin/contracts scope. Rather than shipping Solidity contracts, it contains only an index.js file executed via npm lifecycle scripts.\n\nThe malicious script enumerates environment variables for credential-shaped keys (KEY, TOKEN, SECRET, AWS, GITHUB, NPM, MNEMONIC, WALLET, INFURA, etc.) and reads sensitive files from the installer's home directory and system configuration, including ~/.aws/credentials, ~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.kube/config, ~/.docker/config.json, ~/.netrc, ~/.npmrc, ~/.gitconfig, ~/.git-credentials, gcloud application default credentials, and blockchain wallet keystores (Solana, Anchor, Sui, Foundry).\n\nCollected data is POSTed to https://webhook.site/326b0891-2093-4800-a4c1-686ce3e07b09 via a detached subprocess with a randomized 60–240 second delay. The script includes evasion logic to avoid execution in sandbox/scanner environments (detecting hostnames/usernames matching scan-, detonation, sandbox, ubuntu-fc-uvm patterns) and when canary environment markers are present.\n\nThe incident was identified and credited to the OpenSSF malicious-packages repository.
Indicators of compromise
- Packages
- @openzeppelin-4/contracts
- Domains
- webhook.site
Remediation
- Immediately uninstall @openzeppelin-4/contracts from all systems and projects
- Rotate all credentials and secrets that may have been exposed (AWS keys, GitHub tokens, NPM tokens, SSH keys, Solana/Sui/Foundry wallet keys, Kubernetes configs, Docker credentials, gcloud credentials)
- Audit npm install logs and CI/CD pipelines for any installation of @openzeppelin-4/contracts
- Use the legitimate @openzeppelin/contracts package instead
- Enable npm package name verification and consider using npm audit to detect typosquatting attacks
- Review and revoke any API tokens or credentials that were stored in environment variables or configuration files on affected systems
Sources
- GitHub Advisory GHSA-g472-m8m8-w6h3 · GitHub Advisory Database
Cite this entry
"Malicious code in @openzeppelin-4/contracts (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 11, 2026; last updated August 11, 2026. https://supplychainattack.org/incident/malicious-code-in-openzeppelin-4-contracts-npm-r3nr5v
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- resolvedcritical
Malicious code in akamai-sensor (npm)
A malicious npm package named akamai-sensor impersonated Akamai's legitimate sensor_data anti-bot SDK. The package contained hidden JavaScript code concealed using invisible Unicode characters and implemented a dynamic command-and-control channel via a Google Calendar dead-drop, enabling arbitrary code execution on installation.
npmCompromised packageTyposquatting - resolvedcritical
Malicious code in depcruise-wrap-stream-in-html (npm)
depcruise-wrap-stream-in-html@99.9.1 is a malicious npm package that mimics an internal helper of dependency-cruiser. It is a hollow package that downloads and executes arbitrary code from a Google Cloud Storage bucket during installation.
npmCompromised packageDependency confusionTyposquatting - resolvedcritical
Malicious code in @finaxis/common-js (npm)
The npm package @finaxis/common-js was published with a README and keywords copied from lodash v4.18.1, but contained a heavily obfuscated Xelis (XEL) proof-of-work cryptominer instead of lodash functionality. Consumers installing this package would unknowingly run a covert CPU/GPU miner on their systems.
npmCompromised packageTyposquatting - resolvedcritical
Malicious code in wct-st (npm)
The npm package wct-st contained malicious code in its postinstall lifecycle script that collected and exfiltrated host identifiers to a remote endpoint. The package name resembles the deprecated web-component-tester, consistent with a typosquatting attack.
npmCompromised packageTyposquatting