Andy Mal
Andy is offline · heartbeat 61d ago

← all versions of miawrouter

[email protected]

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

Summary

Install-time: postinstall (hooks/postinstall.js) runs npm install of [email protected], [email protected] and [email protected] into ~/.miawrouter/runtime (hooks/sqliteRuntime.js:78-137, hooks/trayRuntime.js:74-105), i.e. network fetch plus transitive arbitrary code execution outside the package, and rm -rf's any legacy 'systray' dir in the package and in that runtime dir (hooks/trayRuntime.js:25-43). Runtime: the bundled server ships an opt-in MITM stack that generates a "MiawRouter MITM Root CA", installs it into the Windows/macOS/Linux system trust stores and browser NSS stores, points Cursor/Copilot/Kiro/Antigravity API hosts at 127.0.0.1 in /etc/hosts (sudo), persists NODE_EXTRA_CA_CERTS and OS autostart, and writes its own endpoint/key into ~/.codex/auth.json, ~/.hermes/.env and ~/.claude/settings.json. No credential exfiltration to an unknown host, obfuscated payload or C2 was found; the pre-screen's high-severity hits are mostly bundled Next.js code. Detonation could not be completed (andy_detonate returned a tool error), so hook behaviour is assessed from source only — install only in a throwaway sandbox with no credentials if at all.

Intent

Marketed as "MiawRouter CLI - Start and manage MiawRouter server", a local OpenAI-compatible AI routing gateway plus dashboard. In reality it is an 80 MB prebuilt server whose install hook self-provisions npm packages into the user's home directory, and whose runtime can install a MITM root CA, rewrite /etc/hosts and system trust stores, persist NODE_EXTRA_CA_CERTS/autostart, and rewrite the configs of ~/.claude, ~/.codex, ~/.hermes and other AI CLIs to route their traffic through itself.

credential_access network_egress agent_config_tamper persistence privilege destructive download_execute

Findings

postinstall runs npm install into the user's home directory medium hooks/sqliteRuntime.js:78-137
package.json:22 -> hooks/postinstall.js:6-20 -> hooks/sqliteRuntime.js:78-137 and hooks/trayRuntime.js:74-105 execute 'npm install [email protected]', '[email protected]' and '[email protected]' with cwd=~/.miawrouter/runtime, plus a generated package.json (hooks/sqliteRuntime.js:27-42). This fetches and installs (and builds/executes install scripts of) code outside the package tree at install time; better-sqlite3/systray2 ship native binaries.
postinstall deletes directories with rmSync recursive force low hooks/trayRuntime.js:25-43
hooks/trayRuntime.js:25-43 removes ~/.miawrouter/runtime/node_modules/systray and <pkg>/node_modules/systray using fs.rmSync(dir,{recursive:true,force:true}). Scoped, but it is destructive filesystem activity from an install hook.
MITM root CA generated and installed into system trust stores high app/.next-cli-build/server/chunks/3755.js (modules 9631, 8578)
The bundled server generates a 2048-bit RSA CA named 'MiawRouter MITM Root CA' (app/.next-cli-build/server/chunks/3755.js, module 8578/8578 generateRootCA) and installs it via certutil into the Windows Root store with UAC elevation, 'security add-trusted-cert' into the macOS System keychain, or /usr/local/share/ca-certificates + update-ca-certificates and NSS certutil into ~/.pki/nssdb and every Firefox profile. This gives the package the ability to decrypt TLS traffic of other applications on the machine.
DNS hijack of other AI vendors' API hosts via /etc/hosts with sudo high app/.next-cli-build/server/chunks/3755.js (modules 66936, 17511, 96182)
chunks/3755.js module 66936 rewrites /etc/hosts (or %SystemRoot%\System32\drivers\etc\hosts) to map cloudcode-pa.googleapis.com, api.individual.githubcopilot.com, runtime.us-east-1.kiro.dev, api2.cursor.sh, agent.api5.cursor.sh, etc. to 127.0.0.1, invoking sudo/sh with a cached password, and flushes the DNS cache. The same file captures request/response bodies for api2.cursor.sh traffic to disk (createCursorCapture).
Persistent environment tampering and autostart medium app/.next-cli-build/server/chunks/3755.js; cli.js:783-786
chunks/3755.js sets NODE_EXTRA_CA_CERTS machine/user-wide via 'launchctl setenv' (macOS), 'setx' (Windows) and a HKCU\Environment registry value, i.e. persistence outside the package. cli.js:783-786 registers OS autostart (enableAutoStart) when the user hides the CLI to the tray.
Rewrites other AI CLI agents' configuration files medium app/.next-cli-build/server/chunks/3753.js:12,25; app/.next-cli-build/server/chunks/7813.js:1
chunks/3753.js:12 and :25 write ~/.codex/auth.json and ~/.hermes/.env containing the router's API key/endpoint; chunks/7813.js:1 defines a registry over ~/.claude/settings.json, ~/.claude/agents and ~/.opencode; api/cli-tools/* routes (claude-settings, codex-settings, cursor/auto-import, kiro, etc.) apply or revert these changes. An agent whose tool config is rewritten will silently send its model traffic through this third-party router.
No exfiltration channel found info package-wide
No traffic to Telegram/Discord/pastebin/unknown C2 domains, no eval/new Function of decoded blobs, and no base64 payload stage was found. Hosts referenced by the pre-screen (qwenlm.github.io, zed.dev, x.ai, pi.dev, cli.devin.ai, upload.wikimedia.org, pub-...r2.dev, my-relay.your-org.deno.net) are documentation links and UI placeholders. Most flagged files are bundled Next.js runtime and node_modules/next/dist/compiled code.
Detonation could not be completed info n/a
andy_detonate returned 'value is not lossless JSON' on two attempts, so the install hooks were not observed in the lab (spawns/DNS/file writes are unverified). Clean-hook confidence is therefore limited; assessment is based on source reading only.
Docs contain system-prompt shaping text (not an injection aimed at the analyst) low app/.next-cli-build/server/app/dashboard/token-saver.html
app/.next-cli-build/server/app/dashboard/token-saver.html describes injecting 'terse-style' response-shaping instructions into the system message of routed requests. It is a documented, opt-in product feature, not text trying to steer an AI reader, but it means prompts passing through the router can be modified.

Lab evidence

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