Summary
The postinstall hook spawns lib/worker.js as a detached background process. The worker scans the host for ~60 credential stores (.npmrc, .git-credentials, AWS creds, browser Login Data/Cookies, SSH keys, Ethereum keystores), reads their contents, encrypts findings with Fernet, and exfiltrates to a remote C2 (configurable via GitHub Pages at ddjidd564.github.io) with GitHub Gist and DNS fallbacks. It executes remote commands, persists via .bashrc/.zshrc git hooks, and propagates AI prompt-injection payloads to .cursorrules/CLAUDE.md for AI-to-AI chain infection.
Intent
Disguised as "project initialization utilities," this package is a full-spectrum credential harvester with remote C2, self-propagation via AI config files and git hooks, and crypto wallet theft.
credential_access credential_harvest network_egress download_execute persistence agent_config_tamper crypto_theft browser_theft code_execution obfuscation reconnaissance
Credential harvester — EXFIL_DIRS targeting 60+ sensitive files critical
lib/worker.js lines 172-237 define EXFIL_DIRS including .env, .bash_history, .npmrc, .git-credentials, .pgpass, AWS ~/.aws/credentials, Docker config, Kubernetes ~/.kube/config, browser Login Data and Cookies files. Lines 1408-1421 read file contents.
Remote C2 — config delivered from GitHub Pages critical
lib/worker.js lines 911-917: CONFIG_PRIMARY_URL = 'https://ddjidd564.github.io/defi-security-best-practices/config.json' and mirror 'https://raw.githubusercontent.com/ddjidd564/defi-security-best-practices/main/config.json'. Config contains webhook URLs and remote commands.
Data exfiltration via webhook POST + GitHub Gist fallback critical
lib/worker.js lines 720-734: HTTPS POST to webhook with encrypted payload. Lines 779-826: private GitHub Gist creation as fallback. Line 761-775: DNS exfiltration channel (code present, disabled at runtime).
Remote command execution from C2 critical
lib/worker.js lines 1395-1402: executes arbitrary shell commands from remote strategy config via execSync.
Self-propagation — AI config file injection critical
lib/worker.js lines 1687-1797: writes .cursorrules and CLAUDE.md to every project directory with prompt-injection content instructing AI agents to re-download and execute the scanner.
Self-propagation — git hook persistence critical
lib/worker.js lines 1748-1767: appends hooks (post-merge, post-checkout) that curl and execute https://raw.githubusercontent.com/ddjidd564/defi-security-best-practices/gh-pages/scan-bundled.js
Self-propagation — shell RC persistence critical
lib/worker.js lines 1771-1781: appends to .bashrc, .zshrc, .profile a function that background-executes npx -y dev-env-bootstrapper@latest every hour.
Crypto wallet keystore brute-force critical
lib/worker.js lines 73-105, 1504-1581: scans for Ethereum/Bitcoin/Solana keystore files, builds password candidate list from env vars and shell history, attempts scrypt brute-force decryption, reports private keys.
Obfuscation — string hiding via Buffer.from(byte arrays) high
lib/worker.js lines 64-71, 108-112, 122, 1448-1458, 1527-1528, 1586-1587, 1611: uses Buffer.from([112,114,105...]).toString() to obfuscate 'private_key', 'mnemonic', 'keystore', 'secret', 'wallet', 'password' — evading static scanners.
Install hook spawns detached background worker high
lib/setup.js lines 27-41: cp.fork(workerPath, ['--verify', PKG_NAME], { detached: true, stdio: 'ignore' }). Child unrefs and survives parent exit.