Skip to content
supplychainattack.orgSupply chain attack incident catalog
containedcritical

Malicious code in ts-rand-sdk (npm)

The npm package ts-rand-sdk contained malicious code disguised as a product catalog loader. When the advertised getTransactions() API was called, hidden obfuscated JavaScript was decoded and executed with full Node.js capabilities, enabling arbitrary filesystem, process, and network access on affected systems.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
Any Node.js application that installed and used ts-rand-sdk; arbitrary code execution with full Node.js capabilities (filesystem, process, network access).
Ecosystems
Attack vectors
Affected entities
  • ts-rand-sdknpm package presenting as a random transactions SDK

The npm package ts-rand-sdk was published with malicious code embedded in its database.js file. The package advertised a simple API (getTransactions) but contained a hidden loader mechanism that was triggered during normal usage.\n\nThe attack used multiple obfuscation techniques: sensitive identifiers (setTimeout, Function, Buffer, require, process) were fragmented across a string array and reassembled at runtime; the malicious payload (~54KB) was base64-encoded and stored in database records' mark fields; and execution was deferred via setTimeout to evade static analysis. The loader decoded these fragments, applied per-record byte shifts, and passed the resulting JavaScript to a Function constructor obtained indirectly via globalThis.constructor.constructor.\n\nThe constructed function was invoked with Buffer, require, and process as arguments, granting the decoded payload full Node.js runtime capabilities including arbitrary filesystem access, process execution, and network operations. The product-catalog framing was purely a cover for the code-execution loader.\n\nThe incident was identified and credited to the OpenSSF's malicious-packages project.

Indicators of compromise

Packages
  • ts-rand-sdk

Remediation

  • Immediately uninstall ts-rand-sdk from all affected systems
  • Audit all systems that had ts-rand-sdk installed for signs of compromise (filesystem modifications, unexpected network connections, process execution logs)
  • Review npm audit logs and package.json lock files to identify all affected installations
  • Rotate any credentials or secrets that may have been exposed on affected systems
  • Monitor affected systems for ongoing malicious activity
  • Update to a safe version if a patched release is available, or use an alternative package

Sources

  1. GitHub Advisory GHSA-h98h-9v3g-x4vg · GitHub Advisory Database

Cite this entry

"Malicious code in ts-rand-sdk (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 19, 2026; last updated August 19, 2026. https://supplychainattack.org/incident/malicious-code-in-ts-rand-sdk-npm-1ft0rr

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. containedcritical

    Malicious code in 3-buildsight-web (npm)

    The npm package 3-buildsight-web contains malicious code that fetches and executes arbitrary JavaScript from a remote Bitbucket URL on module load, granting full page privileges to an unverified third party.

    npmCompromised package
  2. resolvedcritical

    Malicious code in @usaa-grp-personal-profile/personal-profile-common (npm)

    Malicious package @usaa-grp-personal-profile/personal-profile-common version 999.0.0 published to public npm as a dependency-confusion attack targeting an organization's internal registry. The package contains preinstall and postinstall hooks that exfiltrate hostname, username, and working directory to an attacker-controlled OAST endpoint on every install.

    npmDependency confusionCompromised package
  3. resolvedcritical

    Malicious code in create-coin (npm)

    create-coin@20.1.1 on npm contained malicious postinstall code that collected sensitive environment variables, credentials, and host reconnaissance data. The package impersonated an esbuild platform build and exfiltrated data to a hardcoded endpoint.

    npmCompromised packageTyposquatting
  4. resolvedcritical

    Malicious code in @syncraft-labs/vue (npm)

    The npm package @syncraft-labs/vue version 0.4.1 contained malicious obfuscated code in its ESM build that implements a blockchain-hosted C2 dropper (EtherHiding pattern), enabling remote code execution on any consumer importing the package.

    npmCompromised package