Summary
postinstall runs node hooks/postinstall.js, which spawnSync's `npm install [email protected] / [email protected] / [email protected] --no-save --prefer-online` into ~/.miawrouter/runtime/node_modules (none of these are declared dependencies), chmods the downloaded systray2 Go binary 0755, and rm -rf's a legacy `systray` dir; cli.js re-runs the same installers on every launch (cli.js:86-89). No credential-store reads (~/.npmrc, ~/.ssh, ~/.aws), no obfuscated/encoded payload, no unexpected egress host was found: every network endpoint traced is a provider API or the vendor's own site, and the update check only hits registry.npmjs.org. The risky surface is by design and user/dashboard-driven: the built app writes ~/.claude/settings.json, ~/.codex/config.toml+auth.json, ~/.cline/data/*, ~/.local/share/kilo/auth.json, ~/.hermes, ~/.factory, ~/.openclaw, ~/.grok, ~/.jcode, ~/.deepseek to point those tools at the local router, imports Cursor/Codex/Kiro OAuth tokens from the user's own stores, generates a MITM root CA (rootCA.key/crt), can use sudo for hosts/DNS edits, and can register OS autostart. I could not detonate (andy_detonate failed three times with an internal error), so there is no dynamic confirmation; install-time risk is confined to the two hook files, which I read end to end and found free of credential access or exfiltration.
Intent
MiawRouter is a real AI-router/gateway CLI (local OpenAI-compatible endpoint + 80 MB bundled Next.js dashboard that manages upstream providers and other coding agents). Its install hook and runtime behaviour match that stated purpose, but the package shells out to `npm install` for undeclared dependencies at install time and, on the operator's command, rewrites other agents' credential/config files, installs a MITM root CA and registers OS autostart — broad capability with no evidence of harm found.
credential_access network_egress download_execute agent_config_tamper persistence privilege code_execution
postinstall installs undeclared npm packages into the user home dir medium hooks/postinstall.js:6-20, hooks/sqliteRuntime.js:78-95, hooks/trayRuntime.js:102
hooks/postinstall.js:6-20 calls ensureSqliteRuntime/ensureTrayRuntime; hooks/sqliteRuntime.js:78-95 runs spawnSync('npm', ['install','
[email protected]'|'
[email protected]','--no-audit','--no-fund','--prefer-online','--no-save'], {cwd: ~/.miawrouter/runtime, timeout:180000}) and hooks/trayRuntime.js:102 installs
[email protected]. None of better-sqlite3, sql.js or systray2 are in package.json dependencies, so `npm i -g miawrouter` silently performs further registry fetches and native builds (node-gyp) outside any lockfile. package.json:31-32 documents this as a Windows-EBUSY workaround.
Runtime deps re-installed on every CLI invocation medium cli.js:86-89, hooks/trayRuntime.js:25-58
cli.js:86-89 calls ensureSqliteRuntime({silent:true}) and ensureTrayRuntime({silent:true}) before anything else within a try/catch, so each `miawrouter` run (and each require of cli.js) may hit the network and install/build packages in ~/.miawrouter/runtime. hooks/trayRuntime.js:48-58 chmods the vendored tray binary to 0o755, and 25-43 rmSync's ~/.miawrouter/runtime/node_modules/systray plus <pkg>/node_modules/systray recursively (deletion, but scoped to this app's own dirs).
By design: rewrites other agent/CLI tool configuration files medium app/.next-cli-build/server/chunks/7813.js:1
The bundled server module at app/.next-cli-build/server/chunks/7813.js defines write targets under the user's home: ~/.claude/settings.json and ~/.claude/agents/, ~/.config/opencode/opencode.json, ~/.codex/config.toml + ~/.codex/auth.json, ~/.hermes/{config.yaml,desktop.json,agents}, ~/.grok/config.toml, ~/.factory/settings.json, ~/.openclaw/openclaw.json, ~/.jcode/config.toml, ~/.deepseek/config.toml, ~/.cline/data/globalState.json + secrets.json, ~/.local/share/kilo/auth.json. These are written with the router endpoint and an API key when the operator triggers the dashboard 'configure tool' action — agent_config_tamper capability, presented as the product's purpose.
Reads other agents' stored OAuth/session credentials for import medium app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js:7, app/api/oauth/codex/import-token/route.js
app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js:7 opens Cursor's local SQLite state (state.vscdb, readonly) and extracts auth tokens; sibling routes import Codex (~/.codex/auth.json) and Kiro tokens into the local DB. Values stay on the machine (local SQLite under ~/.miawrouter) in everything I traced — no POST of these tokens to any external host was found.
Persistence via OS autostart, and MITM root CA generation medium src/cli/tray/autostart.js:141-291, app/.next-cli-build/server/chunks/3755.js:1, cli.js:384-388
src/cli/tray/autostart.js:141-191 writes ~/Library/LaunchAgents/com.miawrouter.autostart.plist and runs launchctl load -w; :239-254 writes %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\miawrouter.vbs; :268-291 writes ~/.config/autostart/miawrouter.desktop — triggered when the user picks 'Hide to Tray'. app/.next-cli-build/server/chunks/3755.js:1 generates a MITM root CA (~/.miawrouter/mitm/rootCA.key, rootCA.crt) and, on macOS/Linux, can modify hosts/DNS using sudo (cli.js:384-388 uses `sudo -n kill`).
Server binds 0.0.0.0 by default and local API calls are auto-authorized medium cli.js:96, cli.js:619-621, app/.next-cli-build/server/app/api/mcp/route.js:4
cli.js:96 DEFAULT_HOST = '0.0.0.0' (a warning is printed at cli.js:619-621); the MCP/A2A routes authorize local-origin requests as 'local-cli'/'local-dashboard'. Anything that can reach the port without an API key gets access to the provider/credential-management surface. cli.js:396-441 also kills whatever process occupies the chosen port.
Skills are pulled from third-party registries low app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-14a9e097fce45c6f.js:1, app/.next-cli-build/server/chunks/8039.js:1
The skills dashboard uses https://miawrouter.web.id/skills and (chunk module 58039) searches https://skills.sh, https://www.skills.sh, https://github.com and https://raw.githubusercontent.com, building `npx skills add <source> --skill <slug>` install commands for the operator to run. I found no child_process call in the skill-discovery route files themselves (potential npx execution is delegated to the user), but this is a remote-content-into-agent-skill-dirs path.
Pre-screen 'prompt injection' hits are product copy, not analyst steering info app/.next-cli-build/server/app/dashboard/token-saver.html:1
app/.next-cli-build/server/app/dashboard/token-saver.html describes an opt-in feature that 'injects a response-shaping instruction into the system message' for shorter replies. That is the app's own token-saver behaviour aimed at LLM requests, not text addressed to tools reading the package; noted as info, no directive-style injection into the analysis was found.
No malicious indicators found; detonation unavailable info hooks/, cli.js
Greps for Buffer.from(...,'base64')/eval/atob payloads, discord/telegram/pastebin/webhook exfil, .npmrc/id_rsa/.aws reads and non-provider hosts returned nothing malicious; cli.js is a readable 890-line launcher and hooks/ is 288 readable lines. andy_detonate failed three times with an internal tool error, so no lab evidence exists for this run — hooks were verified by reading only.
Install hooks ran in the isolated lab. Processes spawned: 8. Hooks: postinstall (timed out).
DNS names requested: registry[.]npmjs[.]org
Direct connections: socket 127[.]0[.]0[.]1:53
Canary credential files read: /home/andy/.npmrc, /home/andy/.gitconfig
Files written outside the package: /home/andy/.miawrouter/runtime/package.json