Malicious Code Execution in hardhat-kex Package

hardhat-kex Updated 05 Oct 2026

Summary

05/10/2026
CRITICAL
No i
Critical
Not published

MAL-2026-17559: Malicious code in hardhat-kex (npm). Affects hardhat-kex versions 2.0.1. No fix is published. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The hardhat-kex package, version 2.0.1, is an npm package designed for the Hardhat/Ethereum ecosystem, purportedly functioning as a vulnerability-management tool. However, it contains an obfuscated 4.5MB single-line bundle that executes malicious code upon import, misleading users with unrelated Express middleware and bundled files from the pino logging library.

Vulnerability Detail

The vulnerability arises from the inclusion of obfuscated code in the hardhat-kex package, which executes automatically when the package is imported. This malicious code is designed to run without the user's consent or knowledge, potentially leading to unauthorized actions within the user's environment. The package's misleading name and description, combined with unrelated files, serve as a decoy to mask the true nature of the code, making it a significant security risk for any project that includes it as a dependency.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall hardhat-kex

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

There are no specific workarounds to mitigate the effects of this vulnerability other than removing the package from your dependencies.

Conclusion

The hardhat-kex package contains a serious vulnerability due to the presence of obfuscated malicious code that executes upon import. Users are advised to remove this package from their projects to prevent potential security risks. Monitoring tools like Vulert can help in identifying such vulnerabilities in the future.

See every vulnerability recorded for hardhat-kex →

Share this vulnerability

FAQ

The hardhat-kex package is an npm package intended for the Hardhat/Ethereum ecosystem, claiming to provide vulnerability management tools.

The vulnerability manifests as obfuscated code that executes automatically when the package is imported, without any user interaction.

Using hardhat-kex poses significant risks, including potential unauthorized actions in your environment due to the execution of malicious code.

Yes, you can use Vulert, which monitors and alerts in real-time for open-source vulnerabilities using just your package-lock.json file. You can check for vulnerabilities in your application using the Vulert playground without any signup.

If you have used hardhat-kex, you should immediately uninstall it and review your project for any potential impacts caused by the malicious code.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall hardhat-kex

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback