Malicious code in hardhat-cap (npm)
The npm package 'hardhat-cap' version 2.21.1 contains malicious code disguised within an obfuscated module. The package superficially mimics the pino logger but includes a large, heavily obfuscated payload that executes arbitrary code upon import. This behavior is consistent with a typosquatting attack designed to trick users into executing malicious code when requiring the package.
AI Analysis
Technical Summary
The 'hardhat-cap' npm package version 2.21.1 is a malicious typosquatting package that masquerades as a legitimate logger by copying pino logger files but includes an unrelated, approximately 4 MB obfuscated JavaScript module. This module uses multiple layers of obfuscation techniques including rotated string arrays, dual decoders, RC4 and base64 decoding, and control-flow flattening. The obfuscated code executes immediately when the package is imported, enabling arbitrary code execution on the host system. The mismatch between the package name, source code, and the obfuscated payload strongly indicates intentional malicious intent to compromise users who install or require this package.
Potential Impact
Users who install or require the 'hardhat-cap' package version 2.21.1 risk arbitrary code execution on their systems due to the embedded obfuscated payload that runs at import time. This can lead to system compromise, data theft, or further malware deployment depending on the payload's intent. There are no known exploits in the wild reported yet, but the potential impact is high given the nature of the code execution.
Mitigation Recommendations
No official patch or remediation is currently documented. Users should immediately avoid installing or requiring the 'hardhat-cap' package version 2.21.1. If already installed, remove the package and audit systems for potential compromise. Use verified and trusted package sources and names to avoid typosquatting attacks. Monitor vendor advisories or npm security announcements for any updates or official remediation.
Malicious code in hardhat-cap (npm)
Description
The npm package 'hardhat-cap' version 2.21.1 contains malicious code disguised within an obfuscated module. The package superficially mimics the pino logger but includes a large, heavily obfuscated payload that executes arbitrary code upon import. This behavior is consistent with a typosquatting attack designed to trick users into executing malicious code when requiring the package.
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-cap' npm package version 2.21.1 is a malicious typosquatting package that masquerades as a legitimate logger by copying pino logger files but includes an unrelated, approximately 4 MB obfuscated JavaScript module. This module uses multiple layers of obfuscation techniques including rotated string arrays, dual decoders, RC4 and base64 decoding, and control-flow flattening. The obfuscated code executes immediately when the package is imported, enabling arbitrary code execution on the host system. The mismatch between the package name, source code, and the obfuscated payload strongly indicates intentional malicious intent to compromise users who install or require this package.
Potential Impact
Users who install or require the 'hardhat-cap' package version 2.21.1 risk arbitrary code execution on their systems due to the embedded obfuscated payload that runs at import time. This can lead to system compromise, data theft, or further malware deployment depending on the payload's intent. There are no known exploits in the wild reported yet, but the potential impact is high given the nature of the code execution.
Mitigation Recommendations
No official patch or remediation is currently documented. Users should immediately avoid installing or requiring the 'hardhat-cap' package version 2.21.1. If already installed, remove the package and audit systems for potential compromise. Use verified and trusted package sources and names to avoid typosquatting attacks. Monitor vendor advisories or npm security announcements for any updates or official remediation.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-13616
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a77432dbf8831d539b461f5
Added to database: 08/08/2026, 14:54:37 UTC
Last enriched: 08/08/2026, 15:40:35 UTC
Last updated: 08/09/2026, 00:43:24 UTC
Views: 7
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.
External Links
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.