MAL-2026-17233Malicious code in hardhat-lock (npm)
| Ecosystem | Package | Version |
|---|---|---|
| npm | hardhat-lock | 2.21.0 |
{"modified":"2026-09-28T22:06:53Z","published":"2026-09-28T22:06:53Z","schema_version":"1.7.4","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","affected":[{"package":{"ecosystem":"npm","name":"hardhat-lock"},"versions":["2.21.0"],"database_specific":{"cwes":[{"cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code"}],"indicators":{"evidence_files":[{"path":"lib/config.js","sha256":"3a7f87ca7f738984bd7918a88da35a9898a491fd969e4ff43e619b25f2394abb","tlsh":"f0168345b287bc2742cf2663be0139ec7467656284c8a18bcb56bd1d35bc80bd9e6fd0"},{"path":"package.json","sha256":"41f964a7bcd40ce7bba7db5637bf1b8042f369f6f593d5fffac7444da14025d7","tlsh":"58017620deb88e2301ed25524c2a0643b6618c175528fc2932dba12c4f9d5ff11bf22d"}],"package_integrity":[{"filename":"hardhat-lock-2.21.0.tgz","hashes":{"sha1":"b036b5f9842b331a904a85fbe25837250f4b98b7","sha512_sri":"sha512-ttehUm7EVQpEfmbHPky/yKcqxlZCqW754j8GJA4b8cTesVq+1qkaUy0i5ESIJGhs/vk9cchNrfWad9hcLykTDg=="}}]}}}],"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/hardhat-lock/v/2.21.0"}],"credits":[{"name":"Amazon Inspector","type":"FINDER","contact":["inspector-research@amazon.com"]}],"database_specific":{"malicious-packages-origins":[{"id":"IN-MAL-2026-020620","import_time":"2026-09-28T22:18:23.506719528Z","modified_time":"2026-09-28T22:06:53Z","sha256":"035a099bd6a60e41f1e1cbc1b70f27fecb9bef3f12d54e016d6991b581fc880f","source":"amazon-inspector","versions":["2.21.0"]}]}}数据来源:OpenSSF Malicious Packages · Apache-2.0