{"id":"MAL-2026-17233","summary":"Malicious code in hardhat-lock (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (035a099bd6a60e41f1e1cbc1b70f27fecb9bef3f12d54e016d6991b581fc880f)\nThe npm package hardhat-lock@2.21.0 publishes itself as a logger/middleware but its identity and contents are inconsistent with that purpose: README badges, LICENSE, index.d.ts and docs/* are copied from the unrelated pino project (maintained by pinojs), while the package name squats the Ethereum-tooling keyword 'hardhat'. index.js unconditionally executes require('./lib/config') at module load, and lib/config.js is a ~4MB obfuscator.io-style single-line file (rotated string array of 23,981 entries, hex-escaped tokens, numeric wrapper decoders mt/mw/M0..M5/K/R/s/G, control-flow flattening, and 40,131 inline decoder replacements confirmed by webcrack) whose top-level IIFE runs the moment any downstream code does require('hardhat-lock'). The combination — impersonation of an established package under a different scope-adjacent name, opaque multi-megabyte obfuscated blob with no plausible logging use, and guaranteed import-time execution — is a supply-chain payload carrier: installing and loading the package places attacker-controlled code inside the consumer's Node.js process with unrestricted access to environment variables, filesystem, and network.\n","modified":"2026-09-28T22:30:06.491454670Z","published":"2026-09-28T22:06:53Z","database_specific":{"malicious-packages-origins":[{"source":"amazon-inspector","versions":["2.21.0"],"id":"IN-MAL-2026-020620","import_time":"2026-09-28T22:18:23.506719528Z","modified_time":"2026-09-28T22:06:53Z","sha256":"035a099bd6a60e41f1e1cbc1b70f27fecb9bef3f12d54e016d6991b581fc880f"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/hardhat-lock/v/2.21.0"}],"affected":[{"package":{"name":"hardhat-lock","ecosystem":"npm","purl":"pkg:npm/hardhat-lock"},"versions":["2.21.0"],"database_specific":{"indicators":{"evidence_files":[{"path":"lib/config.js","sha256":"3a7f87ca7f738984bd7918a88da35a9898a491fd969e4ff43e619b25f2394abb","tlsh":"f0168345b287bc2742cf2663be0139ec7467656284c8a18bcb56bd1d35bc80bd9e6fd0"},{"sha256":"41f964a7bcd40ce7bba7db5637bf1b8042f369f6f593d5fffac7444da14025d7","tlsh":"58017620deb88e2301ed25524c2a0643b6618c175528fc2932dba12c4f9d5ff11bf22d","path":"package.json"}],"package_integrity":[{"filename":"hardhat-lock-2.21.0.tgz","hashes":{"sha512_sri":"sha512-ttehUm7EVQpEfmbHPky/yKcqxlZCqW754j8GJA4b8cTesVq+1qkaUy0i5ESIJGhs/vk9cchNrfWad9hcLykTDg==","sha1":"b036b5f9842b331a904a85fbe25837250f4b98b7"}}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/hardhat-lock/MAL-2026-17233.json","cwes":[{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."}]}}],"schema_version":"1.9.0","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}