Malicious Code Injection in hardhat-spack Package

hardhat-spack Updated 05 Oct 2026

Summary

05/10/2026
CRITICAL
No i
Critical
Not published

MAL-2026-17560: Malicious code in hardhat-spack (npm). Affects hardhat-spack versions 3.0.2. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The hardhat-spack package is a middleware factory designed for use with the Hardhat development environment, primarily aimed at facilitating logging functionalities. It is intended to enhance the development experience by providing a structured way to handle logs. However, this package has been compromised, leading to significant security concerns due to the presence of malicious code that can execute arbitrary JavaScript.

Vulnerability Detail

The vulnerability originates from the hardhat-spack package, which internally masquerades as a logging utility while executing malicious code. It spawns a child process that decodes and executes JavaScript fetched from a disposable URL, exposing the application to potential data breaches and unauthorized access. The malicious code can access the filesystem, network, and child processes, allowing attackers to manipulate the environment and extract sensitive information.

How To Fix

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

npm uninstall hardhat-spack

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, you can remove the hardhat-spack package from your project until a secure version is available. This can be done using the command: 'npm uninstall hardhat-spack'. Additionally, consider using alternative logging packages that do not have known vulnerabilities.

Conclusion

The hardhat-spack package contains a serious vulnerability that allows for the execution of malicious code, posing significant risks to applications that utilize it. It is essential to update the package or remove it until a secure version is available to protect your application from potential threats.

See every vulnerability recorded for hardhat-spack →

Share this vulnerability

FAQ

The vulnerability involves malicious code that executes arbitrary JavaScript, potentially compromising the security of applications using the package.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check your application without any signup.

If immediate updates are not possible, consider removing the package and using alternative solutions until a secure version is released.

The malicious code spawns a child process that fetches and executes JavaScript from a disposable URL, allowing attackers to manipulate the application environment.

The vulnerability was identified by Amazon Inspector, which specializes in detecting security issues in software packages.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

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

npm uninstall hardhat-spack

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