Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
Malicious package

hardhat-initnpm

Advisory published Updated

hardhat-init is a confirmed malicious npm package (MAL-2026-17636) that typosquats a legitimate package to trick installs (malicious version 2.21.0). Do not install it — remove it immediately and rotate any exposed credentials.

Malicious code in hardhat-init (npm)

MAL-2026-17636
Immediate action
Remove the package, then rotate any secrets the build/runtime could reach.
npm uninstall hardhat-init

What this malware does

The npm package hardhat-init presents itself as Hardhat initialization tooling and ships a README, LICENSE, and index.d.ts copied from the pino logger project with the name substituted. The main entry index.js requires./lib/config at the top level, which triggers a ~4.3MB heavily obfuscated JavaScript file (lib/config.js) whose top-level IIFE executes immediately on module load. The obfuscation uses hex-escaped string tables, nested index-lookup helpers, and a string-array shuffler consistent with obfuscator.io output, with no plaintext surface describing the behavior. The exported index.js is a trivial no-op that does not consume anything from lib/config, so the sole effect of loading the package is to execute the opaque payload. The combination of a name/content mismatch (hardhat-init vs. copied pino scaffolding), an oversized obfuscated sibling file with no legitimate purpose for an init helper, and auto-execution on require is a typosquat loader shape that causes arbitrary attacker-controlled code to run on the installer's machine the first time any consumer imports the package.

Malicious versions

1 flagged
2.21.0

Indicators of compromise (SHA-256)

e2f570102756d04aa466677488cd13aacac2eb941176523bc4ff024d214affbb

Detection & response playbook

Typosquat
  1. Find it

    Search your lockfiles and build artifacts for hardhat-init (version 2.21.0).

  2. If you installed it — respond

    hardhat-init is a typosquat — you almost certainly intended a legitimately-named package. Remove hardhat-init, install the correct package, and rotate any secrets exposed during the install since post-install scripts may have already run.

  3. Did it already run?

    If hardhat-init was installed, its post-install payload may already have run. Removing the package does not undo that — check outbound connections and credential use from the install window onward.

Frequently asked questions

No. hardhat-init on npm has been identified as a malicious package (version 2.21.0 flagged). It should be removed immediately — do not install or keep it in your dependency tree.

Campaign

IN-MAL-2026-021097

References

Credits

  • Amazon Inspector · finder

Detect & block this

O3 blocks hardhat-init-class packages before install and in CI — and if it already ran, its runtime egress monitoring catches the malicious outbound activity and severs the channel.

Explore

hardhat-init (npm) malicious package — MAL-2026-17636 | O3 Security