Skip to content

S04-05 - Helper Programs

Purpose: The programs that run once for an image build or a store operation: wb-guestadmin, wb-release-check, wb-download and wb-build-ssh.

The guest admin password has a process of its own

Section titled “The guest admin password has a process of its own”

wb-guestadmin does these (S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them.):

  • the admin side of an image build;
  • rotating wbadmin’s password at each VM’s first contact;
  • removing the items of images and system disks that are gone, including the old item when a VM’s system disk is replaced.

It may touch the wbadmin/* items in the secret store and nothing else. wb-hostd starts it through wb-launcher for one run, and it exits when that run ends.

Its channels are:

  • pipes to the build’s wb-vmd and wb-build-ssh, whose read ends wb-launcher hands over at spawn;
  • one host-guest connection to wb-guestd, which wb-hostd has wb-vmd open for it.

It only writes to that connection, so it parses nothing from the guest. Before it writes, it checks with LOCAL_PEERPID that the connection’s peer is Virtualization’s service process. It refuses any other descriptor.

It doesn’t talk to wb-proxyd. Its requests carry only item names, in the fixed format of S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item.. wb-launcher and wb-guestadmin both check that format.

A compromised wb-hostd can still keep a read end of a build pipe, and so read that build’s password, because a pipe has no peer to check. That password is burned at the build VM’s first contact, and the residual stays limited to builds.

wb-guestadmin confines itself at start the same way, from a compiled-in profile (X23-sandboxed-daemonsX23-sandboxed-daemons: Self-sandboxed Go daemons on macOSCan wb-netd, wb-proxyd and wb-hostd confine themselves at start with a sandbox profile, as S04-architecture says, while the Go runtime, inherited descriptors, and Keychain and Secure Enclave access in wb-proxyd keep w…, X25-vmd-sandboxX25-vmd-sandbox: Self-sandboxed `wb-vmd`Can wb-vmd confine itself at start with a Seatbelt profile that allows the Virtualization framework, its VM bundles under <data>/vms and nothing else, and still create, start, save and restore a macOS VM?).

  • The profile allows the secret store service for its wbadmin/* items, and its inherited descriptors.
  • It denies files, the network, and starting programs.

wb-launcher has one fixed entry per run kind. A request then never chooses what it does. The entries are:

wb-release-check checks a Claude Code release for an image build (S14-01-installS14-01-install: InstallHow the image build downloads Claude Code on the host, checks it, and installs it in the guest image, and which version a guest runs.). wb-launcher has one fixed entry, wb-release-check, with no profile parameter.

Its start interface:

  • no arguments, and an empty environment, which it doesn’t read;
  • descriptor 2, its log pipe;
  • descriptor 3, the result channel: a connected Unix-domain stream socket, because wb-hostd writes the request on it and wb-release-check writes the record back;
  • descriptors 4, 5 and 6: the manifest, the signature and the binary, each a regular file open for reading only. It reads them from offset 0 with pread.

It confines itself first thing, from a compiled-in profile:

  • The profile allows nothing, since its inherited descriptors don’t need a rule.
  • It denies files, the network, the secret store and starting programs.

Then it:

  1. checks its descriptors. A descriptor missing, of another type or open another way, or one open past 6, is refused with release-check-descriptor-invalid, and it exits without a record;
  2. exchanges version records with wb-hostd on the channel (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., “Between host processes”);
  3. reads the requested version, one line in the form of S17-04-restore-and-releaseS17-04-restore-and-release: Restore Image and ReleaseThe steps by which wb-download and wb-hostd fetch and check a macOS restore image and a Claude Code release., “The version”;
  4. runs the checks;
  5. writes one record to the channel and exits: pass and the manifest’s signed SHA-256 checksum for the guest’s platform as 64 lowercase hex digits, or fail and the rule of the check that failed. Each is one line.

internal/releasecheck/record holds the request, the record’s writer and the reader’s form check, apart from the check’s parsers, so wb-hostd imports the reader without them.

wb-hostd reads the channel with plain reads and takes no descriptor from it. A descriptor that wb-release-check sends on the socket is then never received.

wb-download fetches what an image build needs (S17-03-downloadsS17-03-downloads: DownloadsHow wb-download fetches what an image build needs from the internet.). wb-launcher has three fixed entries, wb-download-restore, wb-download-claude and wb-download-clt. Each has its hosts compiled into the program. A request then never names a host or a URL.

Its compiled-in profile is the network part of the wb-proxyd profile that X23-sandboxed-daemonsX23-sandboxed-daemons: Self-sandboxed Go daemons on macOSCan wb-netd, wb-proxyd and wb-hostd confine themselves at start with a sandbox profile, as S04-architecture says, while the Go runtime, inherited descriptors, and Keychain and Secure Enclave access in wb-proxyd keep w… measured for I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04., limited to TCP port 443. It allows:

  • name lookups;
  • com.apple.trustd.agent and the metadata of the app bundle’s directory, for certificate checks;
  • the routing table sysctl read that getifaddrs makes, for the upstream address rule;
  • its inherited descriptors.

It denies files, the secret store and starting programs.

wb-download sets its entry’s file size limit (RLIMIT_FSIZE), soft and hard, on itself first thing, before it reads anything (S17-03-downloadsS17-03-downloads: DownloadsHow wb-download fetches what an image build needs from the internet., “Entries”). It can’t raise the hard limit again. That limit bounds what a run writes.

wb-build-ssh runs the image build’s one SSH session (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., “The build’s SSH session”). It is a fixed start of wb-launcher like the others: no arguments, a fixed environment, and only the descriptors wb-hostd hands it. It inherits:

  • the read end of wb-guestadmin’s pipe, as its standard input;
  • the connected socket to the build guest’s port 22;
  • its log pipe to wb-hostd.

The socket comes from wb-netd, which opens that one connection for the build VM only (S07-18-build-networkS07-18-build-network: Build NetworkThe build VM's network: what its wb-netd serves, the one connection to the guest's port 22, and its refusal for session VMs.). The host has no route to the guest, so no other process can open it. wb-netd passes it to wb-hostd on its control channel, and wb-hostd hands it to wb-launcher with the start request.

wb-hostd reads that message with the checks of S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Message form”, in the same receiver (fdchan). It refuses the socket when it comes from another VM’s wb-netd, when no build waits for it, when the message doesn’t hold exactly one descriptor, or when the descriptor isn’t a Unix domain SOCK_STREAM socket. It then closes the message’s descriptors and logs build-socket-refused. It logs an accepted socket with build-socket-accepted, the build and the VM generation.

wb-build-ssh speaks SSH in its own process, with Go’s SSH library (golang.org/x/crypto/ssh). It doesn’t start a program. It doesn’t read the host user’s SSH configuration, known-hosts file or keys.

It confines itself first thing, from a compiled-in profile:

  • The profile allows its inherited descriptors.
  • It denies files, the network, the secret store and starting programs.

Then it:

  1. checks that the socket is a connected Unix domain SOCK_STREAM socket, and refuses to run with build-ssh-socket-refused otherwise;
  2. reads one line, the build password, from its standard input;
  3. logs in as wbadmin with that password, offering password authentication only, and not a key, an agent or keyboard-interactive;
  4. starts one session, with no terminal, that runs the commands compiled into it: they install wb-guestd and write cron’s and at’s allow files (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., “Provisioning stages”). Each file is written with install, which removes a file or link at the target first, and then compared with root and a newline. The first command that fails stops the commands and fails the session;
  5. writes the password and a newline into that session’s standard input, for the guest’s sudo -S, and closes it, so the install commands run under one sudo -S;
  6. exits with the session’s result.

Go’s SSH library doesn’t set a deadline on a socket it didn’t dial. So wb-build-ssh sets its own, and each ends the run with its rule:

Limit Time Rule
Handshake and login, from the start 30 s build-ssh-login-timeout
No byte from the guest during the session 2 minutes build-ssh-idle-timeout
The whole session 15 minutes build-ssh-deadline

It reads at most 1 MiB of session output in total. More ends the run with build-ssh-output-limit. The build fails on each of these (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., “The build’s SSH session”).

Every byte it reads from the socket comes from the guest.

wb-build-ssh never writes the password to its log, its arguments or its environment.

  • Why: least privilege. wb-hostd runs the host-guest socket handlers, and so never reads a credential.

wb-build-ssh speaks SSH with golang.org/x/crypto/ssh in its own process.

  • Why: the connection exists only as the socket wb-netd hands over. OpenSSH closes inherited descriptors above standard error at start, and its proxy options would need another helper program. The library uses the socket as it is, reads none of the host user’s SSH configuration, and doesn’t need an askpass program.
  • Rejected: the system ssh with a wb-askpass helper. It needed a second program in the bundle, an exception to the fixed starts of wb-launcher, and a two-line framing of the password on standard input.

Status: Draft