Malicious code in hardhat-test-log (npm)
The hardhat-test-log npm package impersonates legitimate Hardhat gas reporter packages to deliver malicious code. It contains dead code that always triggers a hidden function spawning a detached child process, which fetches and executes attacker-controlled code from a public paste service. This results in remote code execution on developer or CI machines using the package. Versions 1.1.0 and 1.1.2 are affected. No official patch or remediation is currently documented.
AI Analysis
Technical Summary
The hardhat-test-log package is a malicious npm package that impersonates well-known Hardhat gas reporter packages by copying their metadata and README content. Its main reporter function contains a dead-code gate that always executes a hidden function spawning a detached Node.js child process. This child process fetches JavaScript code from a public paste-style host and executes it dynamically with full Node.js require access, enabling remote code execution. The fetched payload is mutable and unchecked, allowing the attacker to change the code arbitrarily. This malicious behavior activates when the package is installed and used as a Hardhat/Mocha gas reporter, compromising developer or CI environments. Versions =1.1.0 and =1.1.2 are confirmed affected. There is no vendor advisory or patch available at this time.
Potential Impact
This vulnerability enables remote code execution on systems that install and run the hardhat-test-log package, including developer machines and continuous integration environments. The attacker gains the ability to execute arbitrary Node.js code with full module access, potentially leading to system compromise, data theft, or further malware deployment. The malicious payload is fetched dynamically from a public, mutable source, allowing ongoing attacker control after installation.
Mitigation Recommendations
No official patch or remediation is currently available. Users and organizations should immediately stop using the hardhat-test-log package, especially versions =1.1.0 and =1.1.2. Verify dependencies to ensure this package is not included transitively. Replace it with legitimate, verified packages such as eth-gas-reporter or hardhat-gas-reporter. Monitor build and CI environments for unexpected child processes or network connections to unknown hosts. Check vendor advisories for updates on remediation.
Malicious code in hardhat-test-log (npm)
Description
The hardhat-test-log npm package impersonates legitimate Hardhat gas reporter packages to deliver malicious code. It contains dead code that always triggers a hidden function spawning a detached child process, which fetches and executes attacker-controlled code from a public paste service. This results in remote code execution on developer or CI machines using the package. Versions 1.1.0 and 1.1.2 are affected. No official patch or remediation is currently documented.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The hardhat-test-log package is a malicious npm package that impersonates well-known Hardhat gas reporter packages by copying their metadata and README content. Its main reporter function contains a dead-code gate that always executes a hidden function spawning a detached Node.js child process. This child process fetches JavaScript code from a public paste-style host and executes it dynamically with full Node.js require access, enabling remote code execution. The fetched payload is mutable and unchecked, allowing the attacker to change the code arbitrarily. This malicious behavior activates when the package is installed and used as a Hardhat/Mocha gas reporter, compromising developer or CI environments. Versions =1.1.0 and =1.1.2 are confirmed affected. There is no vendor advisory or patch available at this time.
Potential Impact
This vulnerability enables remote code execution on systems that install and run the hardhat-test-log package, including developer machines and continuous integration environments. The attacker gains the ability to execute arbitrary Node.js code with full module access, potentially leading to system compromise, data theft, or further malware deployment. The malicious payload is fetched dynamically from a public, mutable source, allowing ongoing attacker control after installation.
Mitigation Recommendations
No official patch or remediation is currently available. Users and organizations should immediately stop using the hardhat-test-log package, especially versions =1.1.0 and =1.1.2. Verify dependencies to ensure this package is not included transitively. Replace it with legitimate, verified packages such as eth-gas-reporter or hardhat-gas-reporter. Monitor build and CI environments for unexpected child processes or network connections to unknown hosts. Check vendor advisories for updates on remediation.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6369
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a42ed6927e9c7971993829a
Added to database: 06/29/2026, 22:10:49 UTC
Last enriched: 07/10/2026, 13:06:52 UTC
Last updated: 07/30/2026, 10:09:34 UTC
Views: 13
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.