{"id":"MAL-2026-17636","revision":"93e40f82fd864b21b627a9dbfcc3ba04","records":[{"revision":"93e40f82fd864b21b627a9dbfcc3ba04","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"MAL-2026-17636","aliases":[],"title":"Malicious code in hardhat-init (npm)","description":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (e2f570102756d04aa466677488cd13aacac2eb941176523bc4ff024d214affbb)\nThe 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.\n","state":0,"publishedAt":"2026-10-06T04:27:56+00:00","modifiedAt":"2026-10-06T05:00:04.1720359+00:00","affected":[{"ecosystem":"npm","name":"hardhat-init","ranges":[],"versions":["2.21.0"],"rawVersionEvidence":null}],"metrics":[],"references":["https://www.npmjs.com/package/hardhat-init/v/2.21.0"],"sourceUrl":"https://osv.dev/vulnerability/MAL-2026-17636","license":"OSV · upstream source license applies","key":"osv:MAL-2026-17636","identifiers":["MAL-2026-17636"]},"retained":false,"historicalAffected":[]}],"coverage":[]}