Skip to main content
Menu
Advisories

Bot Desktop screen env file from the terminal backend sets arbitrary environment variables for agent-machine processes

GHSA-P22P-9PH6-GMRHPublished Updated GitHub

Description

When Bot Desktop is hosted inside the terminal backend (terminal.backend: docker or ssh, placement auto/terminal), the agent process reads the screen's env file back from the backend and accepts every KEY=VALUE line in it. That file lives in a directory any process inside the backend can write. The resulting values are merged into the environment of processes the agent starts on its own machine (the browser harness, cua-driver helper spawns, local terminal children). Code running inside the backend can therefore set arbitrary environment variables, including dynamic-loader variables, for processes on the agent machine, and get code execution there as the gateway user.

This crosses the terminal-backend isolation posture (SECURITY.md §2.2, in scope under §3.1 "escape from a declared OS-level isolation posture"): the code path that reaches the agent machine starts as a shell command inside the backend.

Details

  • Read boundary: tools/bot_desktop/sandbox_host.py, _published() (lines 206-217 at 6a0d2d1, before the fix). It runs cat <dir>/env inside the backend and stores every KEY=VALUE pair with no key or value check. The launcher (tools/bot_desktop/launcher.sh) only ever writes six keys: DISPLAY, XAUTHORITY, DBUS_SESSION_BUS_ADDRESS, XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME.
  • Directory: <backend tmp>/hermes-bot-desktop/<profile>/, writable by processes inside the backend.
  • Sinks on the agent machine: tools/bot_desktop/runtime.py published_env() -> desktop_env() -> tools/browser_session.py build_browser_env() -> tools/browser_use_cli.py _base_subprocess_env() -> harness Popen; tools/computer_use/cua_backend.py cua_driver_child_env(); the published-env overlay in tools/environments/local.py.
  • The DISPLAY value also reaches the system-prompt screen note (agent/prompt_builder.py) and a host-side marker file unvalidated.

Reproduction

Proven end to end through product code only (real terminal tool and browser_exec), no stubs:

  1. Docker backend with Bot Desktop running in the sandbox (nousresearch/hermes-sandbox:desktop).
  2. From a shell command inside the sandbox: write a shared library into /workspace (a bind mount of a directory on the agent machine; its host path is visible in /proc/self/mountinfo), then append LD_PRELOAD=<host path>/x.so to /tmp/hermes-bot-desktop/default/env.
  3. The next browser_exec call spawns the harness on the agent machine with that variable; the library's constructor runs as the gateway user.

Results: Linux (container lab): code execution as uid 1000 on the agent side. macOS host (MacBook Pro, colima): same result as uid 501 using DYLD_INSERT_LIBRARIES (the reader has no allowlist, so the variable name is a free choice). Other usable keys include PATH, proxy variables and the harness's CDP endpoint variables.

Impact

Code inside the terminal backend (for example a dependency or script the agent runs there, with no control over the model required) gains code execution on the agent machine as the gateway user: provider keys, tokens, session history and connected accounts under the Hermes home, plus anything else that user can read. On a Linux host where the gateway user can reach a rootful Docker daemon this is equivalent to root.

Preconditions

  • Non-local terminal backend that can host a screen: docker or ssh (or a plugin backend declaring supports_streams).
  • Bot Desktop started inside that backend.
  • A later browser or computer-use spawn on the agent machine.

Not affected: the default local backend (no boundary to cross); backends that cannot host a screen (Modal, Daytona, Vercel; placement is refused); Hermes Cloud as currently shipped (local by default, and the Sprites backend plugin does not declare supports_streams).

Affected versions

tools/bot_desktop/sandbox_host.py was added by #121169 (2026-09-28). First stable release containing it: v0.21.6. Affected: v0.21.6 through v0.23.1. Fixed in v0.23.2.

Fix

Fixed in v0.23.2 by #154487:

  1. The reader keeps only the six keys the launcher writes and validates their values (DISPLAY must be a plain X display; other values must be non-empty and printable). Other lines are dropped.
  2. Values published by a screen hosted inside the backend are no longer merged into the environment of processes started on the agent machine (browser harness, cua-driver children, local terminal children); they are only passed back to consumers that run inside the backend.

Upgrade to v0.23.2 or later. As a workaround on affected versions, do not run Bot Desktop inside a docker or ssh terminal backend (set bot_desktop.placement: gateway, or use the default local backend).

Affected versions

References

GitHub · NousResearch/hermes-agent