Skip to content

S15-05 - The Admin Path

Purpose: How the person at the host’s terminal gets a root shell in their own guest, on a path that no agent, session, or guest process can start or reach.

Requirements: SEC08-proj-isolationSEC08-proj-isolation: Per-project isolationEach project has its own guest user, state and history, and one project cannot persist into another., SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter., SEC11-root-gains-nothingSEC11-root-gains-nothing: Guest root is not a privilegeFull control of the guest grants no control over enforcement, secrets, or policy., SEC14-no-fake-approvalsSEC14-no-fake-approvals: Approvals cannot be spoofed by the guestApproval prompts are never rendered in the agent's terminal stream.

Tests: C09-guest-and-sessionsC09-guest-and-sessions: Guest and SessionsThe test cases for what a project user can reach inside the guest, wb-guestd's update and the guest clock, the shared toolchain prefix, the guest admin password, and the session lifecycle.

Brief: B419-admin-pathB419-admin-path: How does the person at the host's terminal get root in their own guest, apart from every agent path?Recommended, a root daemon of its own in the guest, wb-guestroot, opened only by wb vm admin after a typed confirmation.

wb vm admin a person, in its own terminal, types the VM wb claude, wb shell agent sessions and debug shells wb-hostd admin service and handler marks the system disk first, writes 5019 events both through wb-vmd, routed on the guest port ShellService, sessions refused on a marked disk VM, untrusted wb-guestroot root daemon, own port zsh as root on a PTY wb-guestd root daemon, port 1023 users, sessions, git project user agent processes admin port port 1023 no call can't bind or open it
The admin path next to the agent paths. wb vm admin calls a service of its own in wb-hostd, which marks the system disk and connects through wb-vmd to the admin port, where wb-guestroot runs a root shell. wb claude and wb shell reach wb-guestd on port 1023. wb-guestd never calls wb-guestroot, and a project user can neither bind nor open its port.

The admin path gives the person at the host’s terminal a root shell in a running VM. It serves:

It runs as the user, as every Wraith Box process on the host does (SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts.). It uses no secret store item and no wbadmin password (S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact.).

Only wb vm admin <vm> starts it. <vm> is work or isolated.

Agents run in the guest, which can’t reach wb or wb-hostd’s local endpoint (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.).

“A person at a terminal” has two enforcement points:

wb-hostd can’t tell a person from a host process of the user’s UID that runs wb on a terminal of its own. Whoever called, it writes the mark and its 5019 event before a shell opens.

wb-hostd takes the VM’s start lock, and then refuses, each with its rule:

It writes each of these refusals as a 5019 event with its rule (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.: a host log the guest cannot alter). When none applies, it writes the mark and the mark’s 5019 event, and only then lets go of the start lock (“Marked” below). A session start or a VM start meanwhile is refused with vm-admin-used. After that it asks wb-vmd for the admin connection. When the mark or its event can’t be written, it opens no connection.

A dead or wedged wb-guestd doesn’t hold admin-sessions for good. A session ends on the host when the person closes its terminal, or a starting or ending one at its deadline (S06-09-session-lifecycleS06-09-session-lifecycle: Session LifecycleA session's states from wb claude to its summary, how it starts and ends, its deadlines, and when its VM may be saved.). Neither waits for wb-guestd, so the admin path then opens.

The admin path shares no RPC service, guest process, guest port or host handler with sessions and wb shell.

wb-hostd is the one shared process, because it terminates every host-guest connection (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.). The paths share only the controls on guest bytes: the version record, the caps of a guest connection (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs.), and the terminal filter (S16-01-filterS16-01-filter: FilterWhere wb filters guest output, how the filter splits it into tokens, and the allowlist of what passes.). wb runs the filter on the admin stream as on wb shell’s.

The host trusts nothing the shell shows. A guest root that came before can serve a fake wb-guestroot, and it sees everything typed into the shell. So:

A project user and the proxy can’t reach wb-guestroot:

The design relies on wb-guestroot answering while wb-guestd is dead, wedged or restarting. In X31-admin-channelX31-admin-channel: A root shell from a second guest daemonCan wb-guestroot, a root LaunchDaemon apart from wb-guestd on a vsock port of its own below 1024, give the host a root shell on a PTY while wb-guestd is dead, stopped or restarting?, a second root LaunchDaemon gave the host a root shell while wb-guestd was booted out, stopped, and killed in a loop, and a standard user never bound its port.

The shell has no Full Disk Access, and the image build grants wb-guestroot none (B448-admin-channelB448-admin-channel: Does a second guest daemon give the admin path a root shell while wb-guestd is down?Yes, with conditions., option A, decided on I614I614 (closed): Build the admin path: wb-guestroot, the admin service and wb vm adminFollow-up of #448 (X31-admin-channel), as the triage of #448 asked: no issue exists yet for building the admin path of S15-05-admin-path.). TCC holds wb-guestroot, the responsible process, to what a root LaunchDaemon may do, so what TCC guards fails in the shell, such as deleting a user record or reading TCC’s own files. sudo over SSH can do both, since Remote Login has Full Disk Access (X31-admin-channelX31-admin-channel: A root shell from a second guest daemonCan wb-guestroot, a root LaunchDaemon apart from wb-guestd on a vsock port of its own below 1024, give the host a root shell on a PTY while wb-guestd is dead, stopped or restarting?). This isn’t a boundary. With SIP on, root can’t grant itself the access, but it can probably reach it through ssh localhost, since Remote Login holds the grant. X31-admin-channelX31-admin-channel: A root shell from a second guest daemonCan wb-guestroot, a root LaunchDaemon apart from wb-guestd on a vsock port of its own below 1024, give the host a root shell on a PTY while wb-guestd is dead, stopped or restarting? infers that route and didn’t try it.

The image build’s second stage, after the provisioning boot, has wb-guestd install wb-guestroot in /Library/WraithBox/libexec and its LaunchDaemon in /Library/LaunchDaemons, from the guest tools disk. The sealing scan allows that one job (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage., “Sealing”).

wb-guestroot is on the guest tools disk (S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself., “Guest tools disk”). At its start it updates itself from that disk, with the steps and checks of S06-12-guest-agentS06-12-guest-agent: Guest AgentWhat wb-guestd, the service in the guest, does for the host, and how it updates itself., “Update at start”, and installs only itself. At its update, wb-guestd installs every other program on the disk and never wb-guestroot. So a dead wb-guestd doesn’t keep wb-guestroot at an old version, and each program has one installer.

wb-hostd accepts only a wb-guestroot of its own build version, as it does for wb-guestd, and refuses another with peer-version-mismatch.

Before wb-hostd opens the admin connection, it marks the VM’s system disk admin-used in state.db, with the time. A crash after the mark leaves the disk marked. A connection that fails after the mark, such as with peer-version-mismatch or a wb-guestroot that doesn’t answer, also leaves it marked, so the path fails closed.

While the admin connection is open, it counts like a live session:

While the disk is marked:

  • every session start in the VM is refused with vm-admin-used, a debug shell included;
  • wb vm suspend is refused with vm-admin-used;
  • the VM is never saved. When its idle period ends, or its slot is lent, wb-hostd stops it cold;
  • wb vm status shows the mark, its time, and that the next start replaces the system disk.

At the VM’s next start, before wb-vmd boots it, wb-hostd deletes any saved state of the VM and replaces the marked system disk with a fresh clone of the image, as break-glass does (S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact., “Break-glass”). So the start is a cold start. First contact rotates wbadmin again, and the mark goes with the old disk.

The VM can still stop under an open shell: the host shuts down, or wb-hostd or wb-vmd ends. The shell then ends with the VM, and the mark stays. A closed connection ends only the shell’s process group, so a job in another group runs until the VM stops.

A marked VM starts no project session until its system disk is replaced (SEC08-proj-isolationSEC08-proj-isolation: Per-project isolationEach project has its own guest user, state and history, and one project cannot persist into another.: one project can’t persist into another).

The host’s controls don’t depend on the guest (SEC11-root-gains-nothingSEC11-root-gains-nothing: Guest root is not a privilegeFull control of the guest grants no control over enforcement, secrets, or policy.: guest root grants no control over enforcement, secrets or policy). Project users’ separation in the guest rests on what the sealing scan checked (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage., “Sealing”), such as no sudoers entry and no extra admin account (SEC08-proj-isolationSEC08-proj-isolation: Per-project isolationEach project has its own guest user, state and history, and one project cannot persist into another.). A root shell can undo any of that.

The admin path leaves the data volume as it is, mounted when wb-guestd mounted it. The root shell can read and change every project’s home on it, and that is the person’s own data.

What the shell wrote there stays when the system disk is replaced, as T18-data-disk-persistenceT18-data-disk-persistence: Guest root persists on the data diskAn update and break-glass replace a VM's system disk (and, for an update, its auxiliary storage), and keep its data disk (S06-03-image-updates, "Updates", and S15-04-guest-admin, "Break-glass"). says for guest root. wb vm reset-data is the way out (S05-03-management-commandsS05-03-management-commands: Management CommandsThe commands of wb other than the agent commands.).

  • wb-hostd writes a Device Config State Change (5019) event when it marks the disk, and one when the admin connection ends. Each names the VM, the system disk, and the command (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.). The end event names the cause: the shell exited, the connection failed, or the VM stopped.
  • state.db records with the mark whether its end event is written. After a crash of wb-hostd or of the host, wb-hostd writes the missing end event at its next start, with the cause unknown.
  • wb-hostd writes each of its own refusals in “Who can start it” as a 5019 event with its rule, and logs every other refusal with its rule. wb refuses admin-no-terminal and admin-not-confirmed itself, and only logs them.
  • The shell’s input and output aren’t recorded. The person typed them in their own terminal.

Tests reach wb-guestroot through wb-dev-vm’s relay to a guest port below 1024, on bundles from wb-dev-bundle (S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice., “Test tooling”). That tooling is never in the app bundle. No shipped binary has a test-only way to guest root.

Root checks in a VM that the app’s wb-vmd booted use wb vm admin, in an attended run. The admin path adds no network device. The guest reaches the network only through wb-netd (SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.: only allowlisted hosts are reachable).

The guest end is wb-guestroot, a root daemon apart from wb-guestd, on a port of its own.

  • Why: after a root shell, no scan has checked the system disk that project users would run on.
  • Rejected: no mark, only the audit event. Project users would run on a disk with whatever the shell changed.
  • Rejected: a mark the person clears by confirming. That trusts a disk no scan has checked.
  • Rejected: a new data disk as well. It deletes every project’s home, and wb vm reset-data is there when the person wants that.

Status: Draft