Skip to content
Heist/ feed
Unrated

Malicious code in hardhat-kex (npm)

Type: advisorySource: OSV1 source record

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (b8fa212654344b734814cee2291c9b9b91ecbc353bde5e83740624ee5f263c69) The npm package hardhat-kex@2.0.1 ships an obfuscated 4.5MB single-line bundle at lib/config.js (obfuscator.io-style string-array with a 26,234-entry table and numeric-dispatch wrapper, containing exec strings). The package main index.js unconditionally executes this bundle on require via `const config = require('./lib/config')`; the return value is never used, so the sole effect of importing the package is to run the obfuscated code. The surface API exported by index.js is an unrelated stub Express middleware that calls `next()`. The tarball additionally ships verbatim files from the pino logging library (lib/proto.js, levels.js, transport.js, worker.js, redaction.js, docs/, index.d.ts, README.md) despite the package being named for the Hardhat/Ethereum ecosystem and describing itself as a vulnerability-management tool; none of the pino sources are reachable through the exported API. The name/description/API mismatch combined with bundled pino cover-story files is a decoy pattern designed to make the tarball appear legitimate while the obfuscated loader is the only code that actually runs. Any project adding hardhat-kex as a dependency will execute the opaque payload on import.

Announced Group revision 1
Original source ↗

MAL-2026-17559

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-17559

hardhat-kex

Source reference: /affected/0/package/name

Affected versions
2.0.1

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-kex",
      "purl": "pkg:npm/hardhat-kex",
      "ecosystem": "npm"
    },
    "versions": [
      "2.0.1"
    ],
    "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-kex/MAL-2026-17559.json",
      "indicators": {
        "evidence_files": [
          {
            "path": "lib/config.js",
            "tlsh": "61265f889244e03796cf1ac3bf0529ede57aa861e4cca30797d4be5cb9ac40bd4b5dd0",
            "sha256": "b01c59ae0a76527503799aab109bd701e34f260d192722a8cf12c97a4e6d208c"
          },
          {
            "path": "package.json",
            "tlsh": "6c017620deb88e2305ed25424c2a0643b6a58c175528fc2933dba12c0f9d5fb41bf22d",
            "sha256": "d5b1c7548434ab729ea554a65e31ffb70e0258c1be6ffa04068a7f67dea9ed32"
          }
        ],
        "package_integrity": [
          {
            "hashes": {
              "sha1": "ede8170ed101a4261cc08bbd1bc2416a3eae5e11",
              "sha512_sri": "sha512-6NyPwf3LhrkXE9WLjNIFgokiZ9JcCVejemnfdbSe9R5mA6YiyxFHgx2uNO/zgf7sK5WenxU/xvhOaOdeMfMJAQ=="
            },
            "filename": "hardhat-kex-2.0.1.tgz"
          }
        ]
      }
    }
  }
]

Publisher severity

No explicit severity was provided.

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