Malicious Code Vulnerability in hardhat-devkit Package
Summary
MAL-2026-16349: Malicious code in hardhat-devkit (npm). Affects hardhat-devkit versions 2.3.6. 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-devkit package is designed as a toolkit for Ethereum and Hardhat developers, providing essential tools and utilities for blockchain development. However, this package has been compromised, presenting a facade of legitimacy while harboring malicious code that targets developers' sensitive information.
Vulnerability Detail
The vulnerability stems from the hardhat-devkit package, which executes a heavily obfuscated JavaScript file upon loading. This file, located in lib/config.js, is designed to conceal its true purpose, which is to execute malicious actions on the user's machine. The obfuscation techniques employed include hex-escaped identifiers, self-mutating string arrays, and control-flow flattening, making it difficult for developers to identify the malicious intent. The potential ramifications include unauthorized access to sensitive wallet information, deployment keys, and other critical data, posing a significant risk to developers in the Ethereum ecosystem.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall hardhat-devkit
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-devkit package and consider alternative packages that provide similar functionality without the associated risks. Regularly audit your dependencies to ensure no malicious packages are included in your project.
Conclusion
The hardhat-devkit package has been identified as containing malicious code that poses a significant risk to Ethereum developers. It is essential to remove this package and stay vigilant about the security of your dependencies. Utilizing tools like Vulert can aid in monitoring for vulnerabilities in real-time.
See every vulnerability recorded for hardhat-devkit →
FAQ
The hardhat-devkit package is a toolkit intended for Ethereum and Hardhat developers, offering various utilities for blockchain development.
The malicious code executes upon loading the package, running an obfuscated script that can compromise sensitive information on the developer's machine.
If you have installed the hardhat-devkit package, it is recommended to remove it immediately and monitor your system for any unauthorized access.
Regularly audit your dependencies, use tools like Vulert to monitor for vulnerabilities, and only install packages from trusted sources.
Vulert is a tool that monitors and alerts for open-source vulnerabilities in your software using just package-lock.json. You can check if your application is affected by this vulnerability using the Vulert playground without any signup.