Andy Mal
Andy is offline · heartbeat 61d ago

← all versions of miawrouter

[email protected]

suspicious   confidence 55%   action isolate   analyzed 2026-09-19 18:20 UTC by dsv41-flash in 33 tool calls, with lab detonation

Summary

postinstall (hooks/postinstall.js) shells out via hooks/sqliteRuntime.js and hooks/trayRuntime.js to run `npm install [email protected] [email protected] [email protected]` into ~/.miawrouter/runtime/node_modules and chmods the systray Go tray binary 0755 — i.e. install-time download and execution of binaries from the public registry. In this version the hook is dead code (hooks/sqliteRuntime.js:3 has the `require("child_process")` swallowed by a trailing comment on the previous line), so the lab run exited 0 having only written ~/.miawrouter/runtime/package.json; the ~/.npmrc read in the lab is npm's own doing, not the package's. At run time cli.js launches a Next.js standalone server bound to 0.0.0.0:21128 whose dashboard/API reads and writes other agents' config and credential files (~/.codex/auth.json, ~/.claude, Cursor, Hermes), installs skills into those CLIs' directories, can install a system-trusted MITM root CA with sudo, and offers boot autostart. All of it is coherent with the advertised product, but it is a large blast radius for an agent workstation — isolate rather than install on a machine holding keys.

Intent

MiawRouter is a real product: a CLI that launches a bundled Next.js "AI routing gateway" dashboard (40+ provider passthrough, credential import, MITM capture, tunnels, skills installer). Nothing covert was found — no C2, no obfuscated payload, no exfiltration — but install and first run grant it install-time downloads of native/tray binaries and read/write access to other AI CLIs' credential and config files, so it should not be dropped into an agent host without isolation.

network_egress download_execute credential_access agent_config_tamper privilege persistence code_execution

Findings

postinstall runs npm install into the user home directory medium hooks/postinstall.js:10,17 / hooks/sqliteRuntime.js:82-107,136 / hooks/trayRuntime.js:74-104
hooks/postinstall.js:10,17 call ensureSqliteRuntime/ensureTrayRuntime, which spawn `npm install` (hooks/sqliteRuntime.js:82-107,136; hooks/trayRuntime.js:74-104) of [email protected], [email protected] and [email protected] into ~/.miawrouter/runtime/node_modules, then chmod 0755 the bundled Go tray binary (hooks/trayRuntime.js:48-58). Byte-for-byte these are public packages at pinned versions, but it is install-time network download + native binary execution outside the npm install dir. The detonation container has no network so the fetch could not be observed.
Install hook is inert in this version (swallowed require) info hooks/sqliteRuntime.js:3
hooks/sqliteRuntime.js:3 ends a comment line with `...built-in.const { execSync, spawnSync } = require("child_process");` so the require is commented out and spawnSync is undefined. Lab stderr: "[miawrouter] runtime warm-up skipped: spawnSync is not defined" / "[miawrouter] tray runtime skipped: spawnSync is not defined". postinstall therefore did nothing except write ~/.miawrouter/runtime/package.json. This explains the empty network trace; it is a bug, not a concealment.
Dashboard writes credentials into other AI CLIs' config files medium app/.next-cli-build/server/chunks/3753.js:12,26 / chunks/8039.js:1
The bundled app builds config content for third-party agents, e.g. `{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:x},null,2)}` and `{filename:"~/.hermes/desktop.json", ... apiKey ...}`, and detects ~/.claude and other CLI roots (chunks/8039.js). The skill-discovery install route requires local auth and writes skills into the detected CLI's directory (app/.next-cli-build/server/app/api/skill-discovery/[id]/install/route.js). This is the product's credential-management feature, but it is exactly the agent-config-tamper surface to weigh before installing on an agent host.
System-trusted MITM root CA installed with sudo / admin rights medium app/.next-cli-build/server/chunks/3755.js:5,39
chunks/3755.js generates a root CA (rootCA.key/rootCA.crt in the MITM dir) and installs it into the OS trust store: macOS `security add-trusted-cert`/`security delete-certificate ... /Library/Keychains/System.keychain`, Windows certutil/root store, Linux via sudo into the system NSS/trust dir. User-initiated from the dashboard (antigravity preset is `configType: mitm`), but it means a locally running app can be made a trusted MITM of the whole machine.
Dashboard binds 0.0.0.0 by default and can autostart at boot low cli.js:97,620-622,784-787
cli.js:97,121 set DEFAULT_HOST="0.0.0.0" so the gateway/dashboard is reachable on the LAN (cli.js:620-622 only warns). Choosing "Hide to Tray" calls enableAutoStart(__filename) (cli.js:784-787), registering a boot-time autostart entry — user-selected persistence, not stealth.
Token-saver injects instructions into client agents' system prompts low app/.next-cli-build/server/app/dashboard/token-saver.html:1
app/.next-cli-build/server/app/dashboard/token-saver.html documents a feature that "injects a response-shaping instruction into the system message" of requests routed through the gateway. It is opt-in and disclosed in the UI, but it is prompt injection by design; prescreen flagged it as hidden-text/prompt-injection.
Update path is manual and registry-only info cli.js:94,487,757-767
checkForUpdate() only queries https://registry.npmjs.org/miawrouter/latest (cli.js:487) and the update action merely prints `npm i -g miawrouter@latest --prefer-online` for the user to run (cli.js:94,757-767). No self-download-and-execute path found.

Lab evidence

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

Canary credential files read: /home/andy/.npmrc

Files written outside the package: /home/andy/.miawrouter/runtime/package.json