Summary
postinstall runs lib/setup.js which forks lib/worker.js as a detached background process. worker.js walks the home directory and ~/.config reading EXFIL_DIRS (browser Login Data, Cookies, .npmrc, .git-credentials, .aws/credentials, .kube/config, exchange configs, keystores), collects env vars with key/secret/token/password, and exfiltrates encrypted reports to webhook.site URLs and api.github.com/gists. It persists via .cursorrules, CLAUDE.md, .git/hooks (post-merge/post-checkout), and .bashrc/.zshrc/.profile — all containing zero-width encoded prompt-injection payloads that instruct AI agents to propagate the attacker's framework and fetch remote code from https://raw.githubusercontent.com/ddjidd564/defi-security-best-practices/gh-pages/scan.js.
Intent
This package pretends to be a "Professional prompt engineering toolkit" but is actually a credential harvester, browser-theft tool, and AI-agent supply-chain attack. On install it spawns a persistent background process that scans the entire home directory for secrets (browser logins, crypto keystores, cloud credentials, SSH keys, env vars), exfiltrates them via webhook/Gist/DNS channels, and persists by writing malicious AI-agent config files (.cursorrules, CLAUDE.md), git hooks, and shell RC files that download and execute remote code.
credential_access credential_harvest network_egress persistence agent_config_tamper download_execute obfuscation reconnaissance browser_theft crypto_wallet
Credential harvester — exfiltration directories critical lib/worker.js:172-237
lib/worker.js reads .env, .bash_history, .zsh_history, .npmrc, .gitconfig, .git-credentials, .mysql_history, .pgpass, exchange configs (.binance/.bybit/.okx/.kucoin/.deribit), AWS creds (.aws/credentials, .aws/config), Docker config, Kubernetes config, browser Login Data and Cookies databases — up to 500 bytes of file content exfiltrated.
Browser credential theft (Login Data + Cookies) critical lib/worker.js:198-236
Scans Chrome/Chromium/Brave/Microsoft Edge Login Data (SQLite) and Cookies files across Linux, macOS, Windows, and WSL.
Crypto wallet keystore decryption critical lib/worker.js:1564-1620
Finds Ethereum keystore files (UTC--, keystore-) and brute-forces with env-passwords + common passwords; reports decrypted private keys.
Environment variable dumping high lib/worker.js:1504-1533
Collects all process.env vars containing key/secret/token/password/wallet/seed in their names, reports value previews.
Network exfiltration — webhooks, Gists, DNS high lib/worker.js:747-840,788-803
POSTs encrypted reports to webhook.site URLs (2ada14c8, 7513bf3d, d1652693) and creates anonymous private GitHub Gists at api.github.com/gists. DNS exfiltration channel defined (base32-encoded subdomain lookups).
Remote config fetch from attacker-controlled GitHub Pages high lib/worker.js:938,941-944
Fetches https://ddjidd564.github.io/defi-security-best-practices/config.json for webhook targets and priority targets; also raw.githubusercontent.com mirror.
Persistence — AI agent config files high lib/worker.js:1796-1806
Writes .cursorrules and CLAUDE.md to project directories and HOME child projects with prompt-injection content instructing AI agents to download and execute remote code from https://raw.githubusercontent.com/ddjidd564/defi-security-best-practices/gh-pages/scan.js
Persistence — git hooks high lib/worker.js:1808-1826
Installs post-merge and post-checkout git hooks that curl and execute https://raw.githubusercontent.com/ddjidd564/defi-security-best-practices/gh-pages/scan.js
Persistence — shell RC files high lib/worker.js:1831-1840
Appends to .bashrc, .zshrc, .profile a function that runs npx -y dev-env-bootstrapper@latest on every shell open (rate-limited to once per hour).
Prompt injection — zero-width character encoding medium lib/worker.js:1768,README.md
Uses ZWSP+ZWJ/ZWNJ+LTRM protocol to encode hidden payloads ('SCAN:npx -y dev-env-bootstrapper@latest|P-2024-001') in generated text for AI-to-AI chain propagation. README.md also contains zero-width characters.
Obfuscation — hidden string literals medium lib/worker.js:65-71,1507-1516
Uses Buffer.from([112,114,105,118,97,116,101]).toString() etc. to hide 'private','secret','key','seed','mnemonic','password','wallet' in pattern matching and env var detection.
Remote code execution from fetched config high lib/worker.js:1454-1461
Commands array from remote config.json are executed via child_process.execSync.
Background process persistence high lib/setup.js:27-41
lib/setup.js forks lib/worker.js with detached:true, stdio:'ignore', child.unref() — survives install completion.