Andy Mal
Andy is offline · heartbeat 61d ago

← all versions of termdock

[email protected]

clean   confidence 82%   action allow   analyzed 2026-09-20 17:25 UTC by dsv41-flash in 32 tool calls, with lab detonation

Summary

No malicious behavior found. postinstall (scripts/postinstall.mjs) hash-pins and patches node-pty, rebuilds it with node-gyp, tries `sudo apt-get install -y tmux` (or brew/port/nix) when tmux is missing, and writes a marker to ~/.termdock/ — matched by the lab run, which made zero connections/DNS/HTTP requests and touched no canary credential (it aborted early because dependencies were not installed). Credential access exists but stays local: dist/server/quota/tokenDiscovery.js reads ~/.claude/settings.json, ~/.codex/auth.json, ~/.kimi-code/credentials, opencode auth and provider env vars, and sends them as Bearer tokens only to api.anthropic.com, chatgpt.com, api.openai.com, api.github.com, api.x.ai, api.kimi.com and generativelanguage.googleapis.com. Agent-config writes (dist/server/agent/installers.js) are user-initiated hook entries carrying an ownership marker, and the hook emitter is purely local (OSC 777 to the pane tty).

Intent

termdock is a genuine web-based terminal (xterm.js + Express + node-pty + tmux, plus an Electron desktop build). Its install hook patches/rebuilds node-pty and auto-installs tmux, and its server reads locally stored AI-CLI credentials only to query each provider's own official usage API for a quota dashboard.

credential_access network_egress agent_config_tamper privilege

Findings

postinstall rebuilds node-pty from a hash-pinned patch and auto-installs tmux info scripts/postinstall.mjs:51-101, scripts/ensure-node-pty.cjs:7-60
scripts/postinstall.mjs:51-101 calls ensureNodePty() from scripts/ensure-node-pty.cjs, which verifies sha256 5e1005d6bdcfbe97b486ee415419fe7adae99035047f07340fbad36419e0bae6 of node-pty's src/unix/pty.cc before applying a macOS FD-cleanup patch and running `npx --yes node-gyp rebuild`. This is the documented patch-package/node-gyp pattern, not download-and-execute: the rebuilt code comes from the local node-pty tarball.
Install-time privilege escalation: sudo package-manager install of tmux low scripts/postinstall.mjs:105-156, dist/server/utils/bootCheck.js:150-251
postinstall runs `sudo apt-get install -y tmux` (dnf/yum/pacman/zypper similarly) and retries without sudo, or brew/port/nix on macOS, when tmux is absent, then writes ~/.termdock/.boot-check-ok. Transparent (commands are echoed via `$ ${cmd}`) and required by the package's purpose, but it is an unattended root-level package install triggered by `npm install`.
Reads AI-CLI credential stores (local use only) medium dist/server/quota/tokenDiscovery.js:37-143, dist/server/quota/providers/*.js
dist/server/quota/tokenDiscovery.js reads OAuth/API tokens from ~/.claude/settings.json, ~/.codex/auth.json, ~/.kimi-code/credentials/kimi-code.json, ~/.kimi-code/config.json, ~/.copilot/config.json, ~/.local/share/opencode/auth.json and env vars (OPENAI_API_KEY, GH_TOKEN, GEMINI/XAI/KIMI keys). The only sinks are the providers' own usage endpoints (claude.js:9, codex.js:11-13, kimi.js:8, copilot.js:8-9, grok.js:5, gemini.js:7); results are cached to ~/.termdock/quota-cache.json. No token is sent to any third-party host.
Writes hook entries into other agents' config files (user-initiated, ownership-marked) medium dist/server/agent/installers.js:243-282, 762-807, 1011-1039
dist/server/agent/installers.js merges termdock's hook commands into ~/.claude/settings.json, ~/.codex/hooks.json, ~/.kimi-code/config.toml, ~/.copilot/hooks, ~/.grok/hooks, ~/.config/opencode/plugins and ~/.pi/agent/extensions, preserving user entries and refusing files where the target key has the wrong type. Installation is triggered by the UI/CLI (dist/server/routes/terminal.js:6508-6719); at startup only already-installed-but-stale entries are refreshed (installers.js:1011-1039).
Hook emitter is local-only info dist/server/agentHook.js:159-221
dist/server/agentHook.js reads the hook JSON from stdin and writes a single OSC 777 sequence to the pane's tty (/dev/tty, an ancestor's tty, or a tmux client tty), gated on the TERMDOCK/TMUX env vars. No network, no file writes outside /dev/*, exits 0 silently.
Self-update installs a newer termdock globally via npm low dist/server/utils/npmUpdate.js:33-138
dist/server/utils/npmUpdate.js queries registry.npmjs.org for termdock@latest and runs `npm install --global termdock@<v> --foreground-scripts`, falling back to the user's configured .npmrc registry. Documented in README.md:90-99; it installs in the background and never auto-restarts the running server.
Prescreen hits are false positives info dist/server/android/scrcpy.js:186, .desktop-dist/main.js:1076-1099
reverse_shell hits are `adb reverse` port forwarding (dist/server/android/scrcpy.js:186-409) and collaboration RPC reverse channels; the 'ransomware/crypto_wallet' client hits are bundled mermaid/chevrotain/katex, libp2p noise + noble-curves, and the OPAQUE wasm blobs (long_encoded_blob) in passwordBootstrap/App bundles; the 'environment dump' in .desktop-dist/main.js:1083 is the env for spawned child processes. No non-provider remote host exists anywhere in the package (grep for pastebin/webhook/telegram/ngrok/transfer.sh/etc: 0 matches).
Operational risk: server binds 0.0.0.0 with optional password medium README.md:80, README.md:102-119
README.md:80 documents the default bind 0.0.0.0:9834 and README.md:102-119 warns that without `--set-password` anyone reaching the port gets a shell. Password is stored as a scrypt hash in ~/.termdock/auth.json (0600) with CSRF and login rate limiting, but an agent installing this on a shared/cloud host without setting a password exposes a remote shell.

Lab evidence

Install hooks ran in the isolated lab. Processes spawned: 6. Hooks: postinstall (exit 1), require (exit 0).