Malicious Code Detected in hardhat-plus Package - Version 2.21.0
Summary
MAL-2026-17508: Malicious code in hardhat-plus (npm). Affects hardhat-plus versions 2.21.0. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The hardhat-plus package is designed to extend the functionality of the Hardhat Ethereum development environment. It aims to provide additional tools and utilities for developers working on Ethereum-based applications. However, the package has been found to contain malicious code that poses significant security risks to users.
Vulnerability Detail
The vulnerability originates from the hardhat-plus package version 2.21.0, which has been identified as containing malicious code. The package masquerades as a legitimate Hardhat plugin but includes a large, heavily obfuscated JavaScript file that executes upon import. This obfuscation is characteristic of supply-chain malware, which can lead to unauthorized access, data theft, or further exploitation of the user's environment. The obfuscated code is designed to run unconditionally, making it a severe threat to any application that imports this package.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall hardhat-plus
If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, avoid using the hardhat-plus package altogether and look for alternative packages that provide similar functionality without the associated risks. Ensure to audit your package dependencies regularly.
Conclusion
The hardhat-plus package version 2.21.0 has been identified as containing malicious code that poses significant risks to users. It is essential to remove this package from your projects and seek alternatives to ensure the security of your applications. Regular audits and monitoring of dependencies are crucial in maintaining a secure development environment.
See every vulnerability recorded for hardhat-plus →
FAQ
The hardhat-plus package is an npm package intended to enhance the Hardhat Ethereum development environment with additional tools and utilities.
The malicious code can execute upon import, potentially leading to unauthorized access, data theft, or exploitation of your application.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application against the vulnerability using the Vulert playground at Vulert Scanner.
If you have installed hardhat-plus, it is crucial to uninstall it immediately and look for alternative packages that do not pose security risks.
Yes, consider using other well-reviewed packages that provide similar functionalities without the associated risks. Always verify the integrity of packages before installation.