hardhat-lock (npm) · Malicious Code
Affects hardhat-lockSource GCVE Database
Malicious package : remove hardhat-lock and rotate any secrets on hosts that installed it.
Data as of 29 Sep 2026, 04:47 UTC
Malicious package
Published to npm · OSV MAL-2026-17233
What to do
Remove hardhat-lock from every project, lockfile and image that pulls it in. Treat any host that installed it as compromised: rotate the credentials, tokens and keys it could read, from a clean machine.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmhardhat-lock | Affected
| Fixed in– |
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
The npm package hardhat-lock@2.21.0 is a malicious package that impersonates a legitimate logging/middleware library but contains a large, heavily obfuscated payload that executes immediately upon import. This payload grants attacker-controlled code unrestricted access to environment variables, filesystem, and network within the Node.js process. The package misuses the Ethereum tooling keyword 'hardhat' and copies unrelated project documentation to disguise its true nature.