Skip to content
Heist/ feed
Unrated

Malicious code in ts-rand-sdk (npm)

Type: advisorySource: OSV1 source record

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (7f3c43a89866228b5365b9e318da3ea953bb2c5b7da94136d887359e8e1f07a8) 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. ## Source: ghsa-malware (f1f9011f0abb7ca82ed6875b22587eeb4a46afca2285ce54ae90dc720bf9a53a) An

Announced Group revision 1
Original source ↗

MAL-2026-14193

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

ts-rand-sdk

Source reference: /affected/0/package/name

Affected versions
1.0.2

Source reference: /affected/0/versions

1.0.4

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.

[
  {
    "ranges": [
      {
        "type": "SEMVER",
        "events": [
          {
            "introduced": "0"
          }
        ]
      }
    ],
    "package": {
      "name": "ts-rand-sdk",
      "purl": "pkg:npm/ts-rand-sdk",
      "ecosystem": "npm"
    },
    "versions": [
      "1.0.2",
      "1.0.4"
    ],
    "database_specific": {
      "cwes": [
        {
          "name": "Embedded Malicious Code",
          "cweId": "CWE-506",
          "description": "The product contains code that appears to be malicious in nature."
        },
        {
          "name": "Embedded Malicious Code",
          "cweId": "CWE-506",
          "description": "The product contains code that appears to be malicious in nature."
        },
        {
          "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/ts-rand-sdk/MAL-2026-14193.json",
      "indicators": {
        "evidence_files": [
          {
            "path": "index.js",
            "tlsh": "0ef10f6839f930248857b07c67eb9449612de0576e9a6ca87f4d83101f7d13ce1f6ba8",
            "sha256": "c0a1a7e54e1c759e62e48cfa835d79494163da3b37b30c1bd55c5875d9dd24f0"
          },
          {
            "path": "database.js",
            "tlsh": "5a135136cb790c5ba1b84a6069f50a4af2c0472f13a16d877ef4d54c8fb1c5b805ae7b",
            "sha256": "2df9ecfb35f541cddca8430be72e3ccef0efe57f1aa3bd3acf21dc7e8df2114a"
          }
        ],
        "package_integrity": [
          {
            "hashes": {
              "sha1": "84a52526a8e0833538fe7e8223bd222932a19935",
              "sha512_sri": "sha512-y9h8M6E5YRuP3s/SyQ+ys/Z8uzPHR6R7NqytAE1vw88Y2vtyBQCZ3dffJgsBIFfErjdXlE6SDsQ/xi6PRjM8eg=="
            },
            "filename": "ts-rand-sdk-1.0.2.tgz"
          }
        ]
      }
    }
  }
]

Publisher severity

No explicit severity was provided.

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