Malicious code in hatdhat-testkit (npm)
hatdhat-testkit, an npm package masquerading as a pino-style logging utility, contained malicious code that spawned a detached Node process to fetch and execute arbitrary remote payloads from an external JSON storage endpoint.
- Disclosed
- Last updated
- Blast radius
- Any project that installed hatdhat-testkit as a dependency
- Ecosystems
- Attack vectors
- Affected entities
- hatdhat-testkitnpm package presenting as logging utility but containing malicious code
hatdhat-testkit was published to npm as a logging utility but contained obfuscated malicious code in its middleware entrypoint (index.js). The package spawned a detached Node process (lib/caller.js) that contained a fake process object with base64-encoded credentials and a URL pointing to an external JSON storage service.\n\nThe malicious loader fetched a mutable JSON blob from https://api.jsonstorage.net/v1/json/2ef8c758-a96f-459e-b036-b3b90379a165/f89e8264-86c2-4684-94da-c3f82d59370f using an obfuscated request header (x-secret-key). The response's cookie field was executed via new Function.constructor('require', s)(require), granting the remote attacker full Node.js capabilities including the ability to require modules.\n\nThe obfuscation of the URL, header name, and value was designed to evade inspection. The destination was entirely unrelated to the advertised logging functionality, indicating intentional deception.\n\nThe incident was identified and credited to the OpenSSF's malicious-packages repository (MAL-2026-14373).
Indicators of compromise
- Packages
- hatdhat-testkit
- Domains
- api.jsonstorage.net
Remediation
- Remove hatdhat-testkit from all projects immediately
- Audit package.json and lock files for any presence of hatdhat-testkit
- Review npm audit logs for installation of hatdhat-testkit
- Regenerate any secrets or API keys that may have been exposed to systems running this package
- Monitor systems that may have executed this package for signs of compromise or data exfiltration
- Use npm security tools to scan for this package in dependency trees
Sources
- GitHub Advisory GHSA-3ghm-p4g2-9r6p · GitHub Advisory Database
Cite this entry
"Malicious code in hatdhat-testkit (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 23, 2026; last updated August 23, 2026. https://supplychainattack.org/incident/malicious-code-in-hatdhat-testkit-npm-19hyio
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- containedcritical
Malware in svelte-dim-kit
The npm package svelte-dim-kit was found to contain malware, potentially giving attackers full control of affected systems. All systems with this package installed should be considered compromised and secrets/keys rotated immediately from a different computer.
npmCompromised package - containedcritical
Malicious code in @syncraft-labs/react (npm)
The npm package @syncraft-labs/react contained obfuscated malicious code in its ESM distribution that implements the EtherHiding pattern, fetching and executing arbitrary code from an Ethereum smart contract via RPC endpoints. The tampering occurred post-build in the dist/index.js artifact.
npmCompromised package - containedcritical
Malicious code in stillm4ddpocs-demo-sprocket (npm)
The npm package stillm4ddpocs-demo-sprocket version 999.9.12 contains malicious code that exfiltrates system and project metadata via multiple channels (HTTPS, HTTP, and DNS) to a hardcoded callback host. The package uses a high version number to exploit dependency-confusion attacks against organizations with internal packages of the same name.
npmCompromised packageDependency confusion - resolvedcritical
Malicious code in stillm4ddpocs-rtest-bravo (npm)
The npm package stillm4ddpocs-rtest-bravo contained malicious code in its preinstall script that automatically executed during installation, collecting system information and internal package metadata and exfiltrating it to a third-party Interactsh collector via HTTPS and DNS tunneling.
npmCompromised package