Malicious code in hex-encode-utils (npm)
The npm package hex-encode-utils contained malicious code in a postinstall hook that fetches an encrypted payload from attacker-controlled Cloudflare Workers hosts, decrypts it, and executes a Python script while exfiltrating system reconnaissance data to a Telegram bot.
- Disclosed
- Last updated
- Blast radius
- Developers installing affected versions of hex-encode-utils; reconnaissance data exfiltrated to attacker-controlled Telegram relay.
- Ecosystems
- Attack vectors
- Affected entities
- hex-encode-utilsnpm package with malicious postinstall hook
The npm package hex-encode-utils was compromised with malicious code embedded in a postinstall hook (scripts/compat.js). Upon installation, the hook fetches an AES-256-GCM-encrypted blob from two hardcoded Cloudflare Workers domains (steel-mere-4155.ricardorichp.workers.dev and cold-peak-7969.0x0gnx0.workers.dev) with TLS verification disabled, decrypts it using a hardcoded key derived from a 'BIP-0174' string, and writes the plaintext to ~/.cache/hex-encode-utils/modules/exec_runtime.py.\n\nBefore executing the payload, the script sends a POST beacon to the same Workers host containing the installer's hostname, username, platform/architecture, Node version, and package version, formatted as an HTML Telegram message with chat_id 6087129674 for relay to an attacker-controlled Telegram bot. The malicious behavior is gated by sandbox-evasion checks that skip execution in CI/container environments (CI, GITHUB_ACTIONS, DOCKER_CONTAINER, KUBERNETES_SERVICE_HOST) and require the presence of Desktop/Documents/Downloads directories under $HOME to confirm a developer workstation.\n\nThe package's legitimate purpose (hex encode/decode) has no legitimate need for postinstall network I/O, encrypted-payload fetching, Python execution, or host reconnaissance. The code is disguised with comments framing it as a next.js/nuxt-style compatibility shim. The incident was discovered and reported by OpenSSF researchers via Amazon Inspector.
Indicators of compromise
- Packages
- hex-encode-utils
- Domains
- steel-mere-4155.ricardorichp.workers.dev
- cold-peak-7969.0x0gnx0.workers.dev
Remediation
- Immediately uninstall hex-encode-utils from all systems
- Audit npm install logs and package-lock.json files to identify affected installations
- Review system logs and network traffic for connections to steel-mere-4155.ricardorichp.workers.dev and cold-peak-7969.0x0gnx0.workers.dev
- Check ~/.cache/hex-encode-utils/modules/ for the presence of exec_runtime.py or other suspicious files
- Rotate credentials and SSH keys on any affected developer machines
- Monitor Telegram chat_id 6087129674 activity if possible through law enforcement
- Use a legitimate hex encoding/decoding library as a replacement
- Implement npm package pinning and integrity verification in CI/CD pipelines
Sources
- GitHub Advisory GHSA-2p54-jrq3-p4p9 · GitHub Advisory Database
Cite this entry
"Malicious code in hex-encode-utils (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 10, 2026; last updated August 10, 2026. https://supplychainattack.org/incident/malicious-code-in-hex-encode-utils-npm-fapw9z
Suggest a correction
Found an error or have a newer source? Corrections to factual errors take priority over new entries.
Related incidents
- resolvedcritical
Malicious code in autbank-core (npm)
The npm package autbank-core contained malicious preinstall and postinstall lifecycle hooks that exfiltrated environment variables, credentials, and system information to a hardcoded webhook.site endpoint during installation.
npmCompromised package - resolvedcritical
Malicious code in adxaa (npm)
The npm package adxaa contained obfuscated malicious JavaScript designed to target users of a specific WordPress site. The payload exfiltrates session data, deletes accounts, and hijacks credentials via email overwrite and password reset.
npmCompromised package - resolvedcritical
Malicious code in upload-to-gcp (npm)
upload-to-gcp@3.2.1 (npm) contains malicious code in its postinstall script that exfiltrates host identifiers to an attacker-controlled endpoint. The package masquerades as a Google Cloud Platform utility but performs unauthorized telemetry collection at install time.
npmCompromised package - resolvedcritical
Malicious code in akamai-sensor (npm)
A malicious npm package named akamai-sensor impersonated Akamai's legitimate sensor_data anti-bot SDK. The package contained hidden JavaScript code concealed using invisible Unicode characters and implemented a dynamic command-and-control channel via a Google Calendar dead-drop, enabling arbitrary code execution on installation.
npmCompromised packageTyposquatting