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.
Design
Section titled “Design”What it is for
Section titled “What it is for”The admin path gives the person at the host’s terminal a root shell in a running VM. It serves:
- root-only checks in a real guest, such as the data mount cases of 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.;
- a look inside a VM whose
wb-guestdis dead or wedged; - a developer’s own changes to their own VM.
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.).
Who can start it
Section titled “Who can start it”Only wb vm admin <vm> starts it. <vm> is work or isolated.
- It is refused without a terminal on standard input and standard
output, with the rule
admin-no-terminal. - It prints the VM, and says that the VM then takes no project session until its next start replaces its system disk (“Marked” below).
- The person types the VM’s name to go on. Any other answer ends it
with
admin-not-confirmed. No flag skips the question. That is more thanwb vm reset-dataasks, which takes a yes (S05-03-management-commandsS05-03-management-commands: Management CommandsThe commands of wb other than the agent commands.). - It asks in its own terminal, never in a session’s stream (SEC14-no-fake-approvalsSEC14-no-fake-approvals: Approvals cannot be spoofed by the guestApproval prompts are never rendered in the agent's terminal stream.: no approval in the agent’s terminal stream). It is never part of a guest RPC.
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:
wbenforces the terminal and the typed name, as above.wb-hostdaccepts the call only from a peer of the user’s UID, and closes any other withipc-peer-uid(S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.). It then applies the VM state rules below.
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:
vm-not-runningunless the VM runs;admin-slot-lentwhile the isolated VM’s slot is lent to a maintenance VM, the build VM included (S06-07-slot-admissionS06-07-slot-admission: Slot AdmissionHow wb-hostd admits every macOS VM it starts against the limit of two, and lends the isolated VM's slot to a maintenance VM., “Lending the isolated slot”).wb-hostdnever askswb-vmd-installfor the admin port;admin-sessionswhile the VM has a session that is starting, running, paused or ending, a debug shell included. The refusal names each one;admin-openwhile an admin connection to the VM is open, at most one per VM (SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.: host work is capped per VM);admin-before-rotationuntil first contact has rotatedwbadmin’s password, or marked the disk “rotation unknown” (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., “Rotation failure”). Rotation relies on nothing else running (“What first contact relies on” there).
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.
Apart from the agent paths
Section titled “Apart from the agent paths”The admin path shares no RPC service, guest process, guest port or
host handler with sessions and wb shell.
- In the guest,
wb-guestrootis a root LaunchDaemon of its own, apart fromwb-guestd. It listens on its own vsock port below 1024, which only guest root can bind (X27-vsock-confinementX27-vsock-confinement: vsock confinement of project usersCan a non-root process in a macOS guest open AFVSOCK, and bind or listen on wb-guestd's port while wb-guestd is running or being restarted?). It closes a connection from any CID but the host’s. - It serves one service of its own
.protopackage, which runs/bin/zsh -las root on a PTY.wb-guestdneither serves nor calls it. - On the host,
wb vm admincalls a service of its own onwb-hostd’s endpoint, notShellServiceorHostService. wb-hostdaskswb-vmdfor the admin port only for that call. It routes the port’s connections only to that service’s handler. Any other ask for the port is refused withadmin-port-unrequested(S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “The host opens every connection”).
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:
wb vm adminprints the warning of T19-pasted-login-codeT19-pasted-login-code: A login code pasted into a guestClaude Code in the guest can print a real authorize URL with its PKCE challenge. before the shell opens: never paste a login orsetup-tokencode into a guest;wb-hostd’s handler decodes each frame from the guest with the code and caps ofShellService’s handler, and sendswba frame it built itself. A fuzz target covers the decoding of both handlers (C10-terminalC10-terminal: TerminalThe test cases for the terminal filter in wb, which stands between the guest's output and the host terminal., “Fuzzing”);- nothing the shell prints changes a host record. Only
wb-hostd’s own steps write the mark and the events.
A project user and the proxy can’t reach wb-guestroot:
- the session profile denies
AF_VSOCKsockets (S13-02-filesystem-profileS13-02-filesystem-profile: Layer 2: Seatbelt Filesystem Profile (v1)The Seatbelt profile each session's process tree runs under, where it comes from, its exceptions for Xcode builds, and its known gaps., “Host-guest socket”); wb-netdandwb-proxydhold no host-guest connection;- no request from the guest makes
wb-hostdopen the admin port.
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.
In the image
Section titled “In the image”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”).
Its version
Section titled “Its version”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.
Marked
Section titled “Marked”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:
- the idle period doesn’t run (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., “Idle suspend”);
- no maintenance VM is lent the isolated VM’s slot (S06-07-slot-admissionS06-07-slot-admission: Slot AdmissionHow wb-hostd admits every macOS VM it starts against the limit of two, and lends the isolated VM's slot to a maintenance VM., “Lending the isolated slot”);
wb vm stopandwb vm suspendare refused withvm-admin-open, from any terminal.
While the disk is marked:
- every session start in the VM is refused with
vm-admin-used, a debug shell included; wb vm suspendis refused withvm-admin-used;- the VM is never saved. When its idle period ends, or its slot is
lent,
wb-hostdstops it cold; wb vm statusshows 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 data disk
Section titled “The data disk”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-hostdwrites 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.dbrecords with the mark whether its end event is written. After a crash ofwb-hostdor of the host,wb-hostdwrites the missing end event at its next start, with the cause unknown.wb-hostdwrites 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.wbrefusesadmin-no-terminalandadmin-not-confirmeditself, 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).
Decisions
Section titled “Decisions”A guest process of its own
Section titled “A guest process of its own”The guest end is wb-guestroot, a root daemon apart from wb-guestd,
on a port of its own.
- Why: it can answer when
wb-guestdis dead or wedged, and it shares no process or port with the agent paths. - Rejected: a second port in
wb-guestd. It stops answering withwb-guestd, and shares its process with the sessions. - Rejected: a login as
wbadminon a console ofwb-vmd. The fixed device set refuses console devices (S04-02-vm-providerS04-02-vm-provider: VM Provider and StreamsHow wb-vmd hands guest connections and the NIC endpoint to other processes, the fixed device set of a VM, and where wb-proxyd takes a stream's identity from., “What only the code keeps out”). An enabledwbadminreverses I156I156 (closed): S06-vm-lifecycle: v1 break-glass replaces the system disk, wbadmin stays disabledS15-least-privilege (PR #149) uses wbadmin for a break-glass console login when wb-guestd is dead or wedged: wb-guestadmin fetches the VM's password from the secret store, wb vm console shows it once, and the VM gets… and the sealing scan. - Rejected: recoveryOS with
wbadmin(I158I158 (open): S15-least-privilege: developer break-glass through recoveryOS with a disabled wbadminCan the host boot a macOS VM into recoveryOS (VZMacOSVirtualMachineStartOptions, startUpFromMacOSRecovery), authenticate there as the volume owner wbadmin with its host-held password, and get a root Terminal on the…). The guest system is offline there, so root checks of the running guest can’t run.
Marked until the system disk is replaced
Section titled “Marked until the system disk is replaced”- 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-datais there when the person wants that.
Out of scope
Section titled “Out of scope”- A root shell in the build VM.
- Moving files between host and guest. The stream is a filtered terminal (S16-01-filterS16-01-filter: FilterWhere wb filters guest output, how the filter splits it into tokens, and the allowlist of what passes.).
- Windows and Linux guests (S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL.).
Status: Draft