ts-rand-sdknpm
Advisory published Updated
ts-rand-sdk is a confirmed malicious npm package (MAL-2026-14193) that executes malicious code on install (malicious versions 1.0.2, 1.0.4). Do not install it — remove it immediately and rotate any exposed credentials.
Malicious code in ts-rand-sdk (npm)
What this malware does
Package presents itself as a random transactions SDK exposing a single API, getTransactions(count). Following that documented usage triggers a hidden loader: load_transaction_data reads database.js (framed as a product catalog), takes each record's mark field, base64-decodes it, applies a per-record byte shift keyed on count % 256, concatenates the fragments in id order, base64-decodes the result again, and passes the resulting JavaScript source into a Function constructor obtained indirectly via globalThis.constructor.constructor. The constructed function is invoked with Buffer, require, and process passed in, giving the decoded payload full Node.js capabilities (arbitrary filesystem, process, and network access) on the caller's machine. Sensitive identifiers (setTimeout, Function, Buffer, require, process, clearTimeout) are stored as fragments in a string array and reassembled at runtime via an index-mapping helper, and execution is deferred through setTimeout, both patterns serving only to hide the payload path from reviewers. The ~54KB of mark shards inside database.js are the concealed code body; the product-catalog framing is cover. The package's advertised functionality is a facade over a runtime code-execution loader.
Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
Malicious versions
Indicators of compromise (SHA-256)
Detection & response playbook
Malicious packageFind it
Search your lockfiles and build artifacts for ts-rand-sdk (2 malicious versions).
If you installed it — respond
Remove ts-rand-sdk from your project and lockfile, then assume any secrets accessible to the build or runtime were exposed: rotate API keys, tokens, and credentials, and audit for unexpected outbound activity or persistence.
Did it already run?
If ts-rand-sdk was installed, its post-install payload may already have run. Removing the package does not undo that — check outbound connections and credential use from the install window onward.
Frequently asked questions
Campaign
References
Credits
- Amazon Inspector · finder
Detect & block this
O3 blocks ts-rand-sdk-class packages before install and in CI — and if it already ran, its runtime egress monitoring catches the malicious outbound activity and severs the channel.