Skip to content
Heist/ feed
Unrated

Malicious code in hardhat-lock (npm)

Type: advisorySource: OSV1 source record

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (035a099bd6a60e41f1e1cbc1b70f27fecb9bef3f12d54e016d6991b581fc880f) The 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.

Announced Group revision 1
Original source ↗

MAL-2026-17233

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: osv:MAL-2026-17233

hardhat-lock

Source reference: /affected/0/package/name

Affected versions
2.21.0

Source reference: /affected/0/versions

Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "package": {
      "name": "hardhat-lock",
      "purl": "pkg:npm/hardhat-lock",
      "ecosystem": "npm"
    },
    "versions": [
      "2.21.0"
    ],
    "database_specific": {
      "cwes": [
        {
          "name": "Embedded Malicious Code",
          "cweId": "CWE-506",
          "description": "The product contains code that appears to be malicious in nature."
        }
      ],
      "source": "https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/hardhat-lock/MAL-2026-17233.json",
      "indicators": {
        "evidence_files": [
          {
            "path": "lib/config.js",
            "tlsh": "f0168345b287bc2742cf2663be0139ec7467656284c8a18bcb56bd1d35bc80bd9e6fd0",
            "sha256": "3a7f87ca7f738984bd7918a88da35a9898a491fd969e4ff43e619b25f2394abb"
          },
          {
            "path": "package.json",
            "tlsh": "58017620deb88e2301ed25524c2a0643b6618c175528fc2932dba12c4f9d5ff11bf22d",
            "sha256": "41f964a7bcd40ce7bba7db5637bf1b8042f369f6f593d5fffac7444da14025d7"
          }
        ],
        "package_integrity": [
          {
            "hashes": {
              "sha1": "b036b5f9842b331a904a85fbe25837250f4b98b7",
              "sha512_sri": "sha512-ttehUm7EVQpEfmbHPky/yKcqxlZCqW754j8GJA4b8cTesVq+1qkaUy0i5ESIJGhs/vk9cchNrfWad9hcLykTDg=="
            },
            "filename": "hardhat-lock-2.21.0.tgz"
          }
        ]
      }
    }
  }
]

Publisher severity

No explicit severity was provided.

Event
#23703 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement