Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

Malicious code in hardhat-cap (npm)

0
High
Published: 08/07/2026 (08/07/2026, 16:30:20 UTC)
Source: GCVE Database
Product: hardhat-cap

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

npmghsa
hardhat-cap
Affected versions
=2.21.1

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

AILast updated: 08/08/2026, 15:40:35 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses