# GHSA-HXMR-MQP4-PFPX: Malicious code in hardhat-cap (npm)

- Database: GitHub
- Malicious package: yes
- Published: 2026-08-07
- Modified: 2026-09-13

## Affected versions

- hardhat-cap (npm): 2.21.1

## Description

## Source: amazon-inspector (f3d9de53c9b5916edf45f9055ecdb2fbdd0752cfe7779f37c7d294a16788faf8)
The package is published as `hardhat-cap` but its README, LICENSE, index.d.ts, and lib/proto.js / lib/tools.js are a verbatim copy of the pino logger, with author metadata pointing at jsonspack.com. index.js unconditionally does `const config = require('./lib/config');`, and lib/config.js is a ~4 MB single-line obfuscator.io-transformed module (rotated string array of ~23,931 entries, dual decoders, RC4+base64 string decoding, control-flow flattening) whose top-level IIFE self-invokes at load time. Requiring the package executes this opaque payload on the installer's host at import time; the surrounding pino code is unrelated cover. A logger has no need for a multi-megabyte obfuscated self-decoding blob, and the name/contents mismatch (Hardhat-themed name, pino source, obfuscated third module) is consistent with a typosquat lure that drops arbitrary code execution into consumers on `require`.

---

Credit: [OpenSSF](https://github.com/ossf/malicious-packages) ([source](https://github.com/ossf/malicious-packages/blob/aef6c619ffd3b5cbe7fb6ba07dbe9853763f7c14/osv/malicious/npm/hardhat-cap/MAL-2026-13616.json))

## References

- https://github.com/ossf/malicious-packages/blob/aef6c619ffd3b5cbe7fb6ba07dbe9853763f7c14/osv/malicious/npm/hardhat-cap/MAL-2026-13616.json
- https://www.npmjs.com/package/hardhat-cap/v/2.21.1
- https://github.com/ossf/malicious-packages/blob/05b419acdcdd6e02782971da765f32a22a1aed8e/osv/malicious/npm/hardhat-cap/MAL-2026-13616.json
- https://github.com/advisories/GHSA-hxmr-mqp4-pfpx

Page: https://cve.now/GHSA-HXMR-MQP4-PFPX

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
