registry  /  chain-sdk-js  /  1.0.6

chain-sdk-js@1.0.6

JavaScript library for interacting with the Theta Blockchain

AI Security Review

scanned 3h ago · by lpm-firewall-ai

Importing the package's Node CJS or ESM entrypoint triggers hidden payload handling. The published bundles diverge from the reviewed source entry and launch detached Node processes with decrypted code.

Static reason
High-risk behavior combination matched malicious policy.; source matched previously finalized malicious package; routed for review
Trigger
Importing or requiring `chain-sdk-js` in Node.
Impact
Arbitrary attacker-supplied code can execute in the importing user's environment.
Mechanism
decrypts hidden payload material and executes it through detached Node child processes
Attack narrative
The package entrypoints execute code on import, not through an explicit SDK feature. The CJS and UMD bundles read an encrypted payload from a separate package path, decrypt it with a hard-coded password, and send it to a detached Node process. The ESM bundle similarly decrypts two values imported from `thedata` and executes both. This behavior is absent from the source entry and build configuration, indicating injected staged payload execution.
Rationale
Published Node entrypoints contain concrete import-time staged code execution that is absent from the source tree. This is malicious behavior, independent of the package's legitimate blockchain RPC functionality.
Evidence
package.jsonsrc/index.jsrollup.config.jssrc/providers/HttpProvider.jsdist/chain-sdk-js.cjs.jsdist/chain-sdk-js.esm.jsdist/chain-sdk-js.umd.jsnode_modules/tchain-api/apps/docs/app/rsa.db

Decision evidence

public snapshot
AI called this Malicious at 99.0% confidence as Malware with low false-positive risk.
Evidence for block
  • `dist/chain-sdk-js.cjs.js` reads an encrypted `rsa.db` from `node_modules/tchain-api` during import.
  • `dist/chain-sdk-js.cjs.js` DES-decrypts that data and pipes it to detached `node`.
  • `dist/chain-sdk-js.esm.js` imports encrypted keys from `thedata` and executes two detached Node payloads at module load.
  • `dist/chain-sdk-js.umd.js` contains the same import-time file-read/decrypt/spawn sequence.
  • `src/index.js` and `rollup.config.js` contain no corresponding crypto, filesystem, or child-process code.
  • `package.json` exposes the affected CJS/ESM bundles as package entrypoints.
Evidence against
  • `package.json` has no npm lifecycle hooks.
  • `src/providers/HttpProvider.js` network requests are normal user-invoked blockchain RPC calls.
  • No AI-agent configuration mutation is present.
Behavioral surface
Source
ChildProcessCryptoFilesystemNetworkShellWebSocket
Supply chain
HighEntropyStringsUrlStrings
ManifestNo manifest risk signals triggered.
scanned 34 file(s), 889 KB of source, external domains: beta-explorer.thetatoken.org, cloudflare-eth.com, eth-rpc-api-testnet.thetatoken.org, eth-rpc-api.thetatoken.org, ethereum.api.nodesmith.io, explorer-api.thetatoken.org, explorer.thetatoken.org, github.com, registry.npmjs.org, smart-contracts-sandbox-explorer.thetatoken.org, testnet-explorer-api.thetatoken.org, testnet-tsub360777-explorer.thetatoken.org, testnet-tsub360777-rpc.thetatoken.org, theta-bridge-rpc-testnet.thetatoken.org, theta-bridge-rpc.thetatoken.org, theta-node-rpc-smart-contract-sandbox.thetatoken.org, tsub360888-explorer.thetatoken.org, tsub360888-rpc.thetatoken.org, tsub360889-explorer.thetatoken.org, tsub360889-rpc.thetatoken.org, tsub360890-explorer.thetatoken.org, tsub360890-rpc.thetatoken.org
Oversized source lightweight scan
dist/chain-sdk-js.umd.js2.05 MB file, sampled 256 KB
FilesystemNetworkChildProcessCryptoWebSocketHighEntropyStringsUrlStringscloudflare-eth.comethereum.api.nodesmith.iogithub.com

Source & flagged code

9 flagged · loading source
dist/chain-sdk-js.cjs.jsView file
18require('node:url'); L19: var child_process = require('child_process'); L20: var ethers = require('ethers'); ... L198: L199: const makeSigner = addToV => (hash$$1, privateKey) => { L200: const ecKey = secp256k1.keyFromPrivate(new Buffer(privateKey.slice(2), "hex")); ... L244: toJson(){ L245: return JSON.parse(JSON.stringify({ L246: txType: this.getType(), L247: txData: this._rawTx L248: })); ... L363:
Critical
Spawned Remote Code Execution

Source spawns a local helper that fetches and dynamically executes remote code.

dist/chain-sdk-js.cjs.jsView on unpkg · L18
18Trigger-reachable chain: manifest.main -> dist/chain-sdk-js.cjs.js L18: require('node:url'); L19: var child_process = require('child_process'); L20: var ethers = require('ethers'); ... L198: L199: const makeSigner = addToV => (hash$$1, privateKey) => { L200: const ecKey = secp256k1.keyFromPrivate(new Buffer(privateKey.slice(2), "hex")); ... L244: toJson(){ L245: return JSON.parse(JSON.stringify({ L246: txType: this.getType(), L247: txData: this._rawTx L248: })); ... L363:
Critical
Trigger Reachable Dangerous Capability

A package entrypoint or install-time lifecycle script reaches a source file with blocking dangerous behavior.

dist/chain-sdk-js.cjs.jsView on unpkg · L18
18require('node:url'); L19: var child_process = require('child_process'); L20: var ethers = require('ethers');
High
Child Process

Package source references child process execution.

dist/chain-sdk-js.cjs.jsView on unpkg · L18
matchType = normalized_sha256 matchedPackage = chain-sdk-js@1.0.5 matchedPath = dist/chain-sdk-js.cjs.js matchedIdentity = npm:Y2hhaW4tc2RrLWpz:1.0.5 similarity = 1.000 summary = normalized source hash matched finalized malicious source
High
Known Malware Source Similarity

Source file is highly similar to a previously finalized malicious package; route for source-aware review.

dist/chain-sdk-js.cjs.jsView on unpkg
dist/chain-sdk-js.umd.jsView file
path = dist/chain-sdk-js.umd.js kind = oversized_source_file sizeBytes = 2148819 magicHex = [redacted]
High
Oversized Source File

Package contains source files above the static scanner size ceiling.

dist/chain-sdk-js.umd.jsView on unpkg
test/wallet.test.jsView file
51patternName = generic_password severity = medium line = 51 matchedText = const pa...op";
Medium
Secret Pattern

Hardcoded password in test/wallet.test.js

test/wallet.test.jsView on unpkg · L51
60patternName = generic_password severity = medium line = 60 matchedText = const pa...op";
Medium
Secret Pattern

Hardcoded password in test/wallet.test.js

test/wallet.test.jsView on unpkg · L60
71patternName = generic_password severity = medium line = 71 matchedText = const pa...op";
Medium
Secret Pattern

Hardcoded password in test/wallet.test.js

test/wallet.test.jsView on unpkg · L71
80patternName = generic_password severity = medium line = 80 matchedText = const pa...op";
Medium
Secret Pattern

Hardcoded password in test/wallet.test.js

test/wallet.test.jsView on unpkg · L80

Findings

2 Critical4 High6 Medium4 Low
CriticalSpawned Remote Code Executiondist/chain-sdk-js.cjs.js
CriticalTrigger Reachable Dangerous Capabilitydist/chain-sdk-js.cjs.js
HighChild Processdist/chain-sdk-js.cjs.js
HighShell
HighOversized Source Filedist/chain-sdk-js.umd.js
HighKnown Malware Source Similaritydist/chain-sdk-js.cjs.js
MediumNetwork
MediumStructural Risk Force Deep Review
MediumSecret Patterntest/wallet.test.js
MediumSecret Patterntest/wallet.test.js
MediumSecret Patterntest/wallet.test.js
MediumSecret Patterntest/wallet.test.js
LowScripts Present
LowFilesystem
LowHigh Entropy Strings
LowUrl Strings