X17 - Unattended image build
Purpose: Whether a macOS guest installed from an Apple restore image can get past Setup Assistant with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks or MDM, and how long a build takes.
For review
Section titled “For review”- Decides: the answer to X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM? (I28I28 (closed): X17-image-build: Unattended image buildX17-image-build (added to S11-verification-and-spikes in #14)), and how
wb image buildgetswb-guestdinto a new guest, which S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does., now states. - You are approving: the answer “no”, and the build that replaces
the one S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. described. The first boot uses the macOS 27
provisioning options, which create a provisioning user and turn
Remote Login on, and one SSH session as that user installs
wb-guestd. Everything after that goes throughwb-guestd. The build then turns Remote Login off and disables the provisioning user, because macOS refuses to delete it, and the sealing scan fails the build on either. A build takes about 6.6 minutes from a downloaded restore image. - Controls touched: SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts.: an exception is needed,
see decision 4. A host process has to hold the provisioning password
during a build. The issue’s candidate fails because SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. rules out
root on the host, since an unprivileged host can’t write the
root-owned files launchd needs. SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.
and SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable. are kept by the sealing scan, which now fails
the build on Remote Login, automatic login,
/etc/kcpassword, the provisioning user unless it is disabled, and files a non-system user owns. The provisioning boot has a network the product VM doesn’t have (open decision 2). - Assumed: that the SSH session can run over the build VM’s own file-handle network and the host’s userspace stack instead of a NAT network. The spike used NAT for that one boot. That a disabled account that holds the volume’s secure token gives a project user nothing (I142I142 (closed): X17-image-build: measure whether guest root can revive the disabled provisioning user secure tokenFrom the security review of PR #141 (X17-image-build, #28), finding 2. measures it). The spike tried neither.
- Open decisions:
- The provisioning user stays in the image, disabled, because macOS refuses to delete the last secure token holder. The I28I28 (closed): X17-image-build: Unattended image buildX17-image-build (added to S11-verification-and-spikes in #14) comment of 2026-10-04 asked for it to be removed. Recommended: accept the disabled user, which S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. already allowed (“disabled or removed”), and have the sealing scan check the properties that make it harmless. This rests on the secure-token assumption above (I142I142 (closed): X17-image-build: measure whether guest root can revive the disabled provisioning user secure tokenFrom the security review of PR #141 (X17-image-build, #28), finding 2.).
- Which network carries the one SSH session. Recommended: the build
VM’s file-handle network, with the host dialing the guest’s port
22 through its userspace stack and nothing else reachable, tried
in I139I139 (closed): S06-vm-lifecycle: SSH for the image build's provisioning boot without a NAT networkX17-image-build (#28) answered "no": a host without root can't get wb-guestd into a new macOS guest by writing to its disk.. The alternative is a NAT network for the
provisioning boot only, as in this spike, which gives the guest
unfiltered internet before any project code has run. The spike’s
SSH client also didn’t check the guest’s host key
(
StrictHostKeyChecking=no), so nothing authenticated the guest end of that session. - The provisioning options are new in macOS 27, so this build needs a macOS 27 host, and NFR04-host-platformsNFR04-host-platforms: Host platformsFirst target: Apple Silicon, macOS 27 or later, because wb image build needs the guest provisioning options that are new in macOS 27 (X17-image-build). says macOS 15 or later. No build without SSH or clicks was found for older hosts. Recommended: raise NFR04-host-platformsNFR04-host-platforms: Host platformsFirst target: Apple Silicon, macOS 27 or later, because wb image build needs the guest provisioning options that are new in macOS 27 (X17-image-build). to macOS 27 for v1 hosts. The alternative is to ship built images to older hosts, which S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. leaves for later. Tracked in I143I143 (closed): NFR04-host-platforms: macOS 27 host for wb image build (X17 decision 3)X17-image-build (PR #141, #28) found that wb image build needs a macOS 27 host..
- Which host process holds the provisioning password, for how long, and over which channel. The provisioning options take it, the one SSH session needs it, and the disable step needs it again to keep the secure token usable. Holding it is an exception to SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts., so it is the maintainer’s decision, in I145I145 (closed): SEC12-least-privilege: who holds the image build provisioning password (X17)X17-image-build (PR #141, #28) found that the image build needs a provisioning password: - wb-vmd sets it on VZMacGuestProvisioningOptions; - the build's one SSH session uses it; - wb-guestd's disable step needs the…. Until then the build fails closed, and S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. states the rules that hold whatever I145I145 (closed): SEC12-least-privilege: who holds the image build provisioning password (X17)X17-image-build (PR #141, #28) found that the image build needs a provisioning password: - wb-vmd sets it on VZMacGuestProvisioningOptions; - the build's one SSH session uses it; - wb-guestd's disable step needs the… decides. I145I145 (closed): SEC12-least-privilege: who holds the image build provisioning password (X17)X17-image-build (PR #141, #28) found that the image build needs a provisioning password: - wb-vmd sets it on VZMacGuestProvisioningOptions; - the build's one SSH session uses it; - wb-guestd's disable step needs the…’s option 4, which avoids a shared password, works whichever way I142I142 (closed): X17-image-build: measure whether guest root can revive the disabled provisioning user secure tokenFrom the security review of PR #141 (X17-image-build, #28), finding 2. comes out, because a dead token is acceptable when images are rebuilt and never updated. So it would remove the need for a SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. exception, and I142I142 (closed): X17-image-build: measure whether guest root can revive the disabled provisioning user secure tokenFrom the security review of PR #141 (X17-image-build, #28), finding 2. only has to rule out the token staying usable after a root reset.
- Brief: B28-image-buildB28-image-build: Can an unprivileged host build a macOS guest image without SSH or clicks?No.
Question
Section titled “Question”From X00-indexX00-index: SpikesThe open questions that must be answered by a throwaway prototype before work builds on them, in the order they are taken up.: can a macOS guest installed from an Apple restore image
get past Setup Assistant, with wb-guestd running as a root
LaunchDaemon, without SSH, scripted clicks, or MDM? The candidate was
writing files to the new guest’s Data volume from the host at build
time, before any untrusted code has run. Measure the build time from
the restore image. The maintainer’s comment on I28I28 (closed): X17-image-build: Unattended image buildX17-image-build (added to S11-verification-and-spikes in #14) adds: whatever
provisioning X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM? picks, show Remote Login off, the
provisioning user removed, and the sealing scan of S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does.
extended to check for both (SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.,
SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.).
Answer
Section titled “Answer”No. A host without root can’t get wb-guestd running as a root
LaunchDaemon by writing to the guest’s disk, and no other way without
SSH that the spike tried worked. The build that works uses one SSH session. Each part, with
the evidence in “Measurements”:
- The host can mount the Data volume as the user: yes. After the
install,
hdiutil attachanddiskutil mountof the bundle’s disk worked withoutsudo. The Data volume wasn’t encrypted. The mount ignores ownership, so the host could write anywhere on it. - Every file the host writes belongs to the host user: verified.
New files and directories got the host user’s uid (501) and group
20, and
chownto root failed with “Operation not permitted”. uid 501 is also the first account macOS creates in the guest, so awb-guestdbinary written this way would belong to whoever gets 501 there. - launchd refuses what the host writes: no daemon ran.
- A LaunchDaemon plist, the binary and
/var/db/.AppleSetupDone, as the issue proposed: the guest booted and nothing answered on vsock in 150 s. At boot,smdbootstrapped the two plist files macOS ships in/Library/LaunchDaemonsand skipped the one the host wrote. A second host-written daemon, which only touches a file, never ran either. - A LaunchAgent in
/Library/LaunchAgents, with a provisioning user logged in automatically, meant to runsudowith a password the host left: launchd logged “Caller specified a plist with bad ownership/permissions” for it, for every user session including the provisioning user’s. - The same LaunchAgent in that user’s own
~/Library/LaunchAgents, owned by the user’s uid: it didn’t run, and launchd logged nothing about it. The spike didn’t find out why. - With root on the host the files could be owned by root, but SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. rules out root on the host, so the spike didn’t try it.
- A LaunchDaemon plist, the binary and
- The provisioning options get past Setup Assistant: yes.
VZMacGuestProvisioningOptions(macOS 27 host and guest, as in X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest?) created the userwbprovwith a password and Remote Login on. The guest wrote/var/db/.AppleSetupDoneitself, owned by root. Later boots go straight to the login window, and no Setup Assistant process runs. - One SSH session installs
wb-guestd: yes. SSH aswbprovanswered 21 to 24 s after the start, andsudo installpluslaunchctl bootstrapput the test daemon in place as root. The host reached it over vsock 23 to 26 s after the start. From then on the spike talked to the guest over vsock only. - Remote Login off: yes. Through the test daemon,
launchctl bootoutandlaunchctl disableofcom.openssh.sshdstopped sshd, andsystemsetup -getremoteloginreports Off. It stays off after a reboot. - The provisioning user removed: no.
wbprovholds the volume’s only secure token and is its volume owner.sysadminctl -deleteUserrefuses (“it’s either last admin user or last secure token user”),sysadminctl -secureTokenOffrefuses (“User cannot disable their own SEP credential”), anddscl . -deletefails witheDSPermissionError. Root also couldn’t delete its home:chmod -NonDesktop,DocumentsandDownloads, which have an “everyone deny delete” ACL, failed with “Operation not permitted”. The spike didn’t find out whether Full Disk Access would allow it. - The provisioning user disabled: yes. The test daemon took
wbprovout ofadminand every other group it could, changed its password withsysadminctl -resetPasswordForto a random one that nothing kept, disabled it withpwpolicy -disableuser, set its shell to/usr/bin/false, hid it, and removed its login keychain. After that,pwpolicy -authentication-allowedreports “account is disabled” anddscl . -authonlyrefuses the old password. It keeps the secure token. It stays a member of_lpoperatorand a share point group, through nested groups every local user is in, and incom.apple.access_disabled. - The sealing scan catches both: yes. Run as root by the test
daemon on the provisioned guest, it failed with 8 findings, among
them
wbprovinadminwith a password,com.openssh.sshdenabled and loaded, a listener on TCP port 22,wbprov’s files outside its home, and its login keychain. After the cleanup it passed, and it passed again on the next boot of the sealed image.
The conditions of the build that works:
-
The host runs macOS 27 or later, for the provisioning options (open decision 3, I143I143 (closed): NFR04-host-platforms: macOS 27 host for wb image build (X17 decision 3)X17-image-build (PR #141, #28) found that wb image build needs a macOS 27 host.).
-
The first boot is the only one with SSH. It uses the provisioning options with a random password, which a host process holds during the build (open decision 4, I145I145 (closed): SEC12-least-privilege: who holds the image build provisioning password (X17)X17-image-build (PR #141, #28) found that the image build needs a provisioning password: - wb-vmd sets it on VZMacGuestProvisioningOptions; - the build's one SSH session uses it; - wb-guestd's disable step needs the…), and one SSH session that installs
wb-guestdand nothing else. No product image descends from a bundle that skipped the later steps. -
All later provisioning goes through
wb-guestd, over vsock, starting with Remote Login off and automatic login off. -
The provisioning user is disabled, not removed (open decision 1). Its password is replaced with a random one that the build discards.
-
The sealing scan runs in the guest, as root, through
wb-guestd, before any project code has run (I144I144 (closed): S06-vm-lifecycle: which user installs the base layer before sealingFrom the security review of PR #141 (X17-image-build, #28), finding 3. settles which user installs the base layer, and when). It fails the build on: an enabled account inadminorwheelother than root and the system accounts macOS ships in it; a non-system account other than one that is the volume owner, disabled, hidden, without a shell, and only instaff,everyone,localaccounts,_lpoperator,com.apple.sharepoint.group.*andcom.apple.access_disabled(the grouppwpolicyadds when it disables an account); Remote Login (sshd enabled or loaded, or a listener on port 22); screen sharing or remote management; automatic login or/etc/kcpassword; sudoers additions; files outside/Usersowned by a non-system uid other than that user’s temporary folders; launchd jobs outside an allowlist of what macOS ships (com.apple.*andamsdstat.plistin/Library/LaunchDaemons) pluswb-guestd’s; and the secrets the scan already looked for. 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”, adds checks the spike’s scan didn’t have: membership throughdsmemberutil,authorized_keys,sshd_config, SSH host keys, the kept user’s LaunchAgents, its secure token, andIsHidden.The spike’s scan treated an account as enabled when its
AuthenticationAuthorityhad aShadowHashentry, which is what a password login needs. macOS ships_mbsetupuserinadminwithout one. -
The host never mounts a guest disk to build an image. It doesn’t need to, and the host then parses no guest-written filesystem.
Measurements
Section titled “Measurements”Host: Apple M2, 8 cores, 16 GB, macOS 27.0.1 (26A434), Xcode 27.0, Go
1.27.1, no sudo. Guest: macOS 27.0.1 from
UniversalMac_27.0.1_26A434_Restore.ipsw (26.6 GB, already
downloaded), 4 vCPU, 4 GiB, one 64 GiB sparse system disk,
VZVirtioSocketDevice, and a file-handle network attachment with
nothing behind it, or a NAT network for the provisioning boot. Each run
started from a fresh APFS clone of one installed bundle. The clock
starts when the boot tool starts the VM.
| Step | Time | Runs |
|---|---|---|
| Install from the local restore image | 271.6 s | 1 |
| Host mounts the Data volume, writes, unmounts | 2.2 to 3.5 s | 3 |
| Provisioning boot: SSH answers | 21 to 24 s | 3 |
| Provisioning boot: test daemon answers on vsock | 23.1 to 26.0 s | 3 |
| Sealing scan, in the guest | 19.4 to 32.2 s | 11 |
| Cleanup and disable requests, guest-side time | 40.7 s | 1 |
| Provisioning boot, start to guest stopped (full pipeline) | 127.1 s | 1 |
| Provisioned image, cold boot to the test daemon answering | 8.5 to 11.0 s (median 8.8 s) | 6 |
- Build time: 271.6 s to install and 127.1 s for the provisioning
boot make 398.7 s, about 6.6 minutes, from a downloaded restore image
to a sealed image. Of the 127.1 s, the two scans took 54.7 s, and the
cleanup request took 38.7 s in the guest, with the deletion attempts
that a product build skips and two
findpasses over the Data volume. The 40.7 s in the table is that request plus the disable request (2.0 s). A verification boot of the sealed image, start to guest stopped, took 35.6 s more. The restore image download was not measured (I49I49 (closed): S10-tech-stack: installation, restore image download, upgrades and migrationsS10-tech-stack "Packaging and signing" gives the shape of the macOS app bundle.). - Cold boot: after the provisioning boot, the daemon started 7.6 to 10.1 s after the guest kernel’s boot time, with one disk. X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest? measured 10.9 s (p50) to its listener with two disks (I86I86 (open): Cold boot to wb-guestd takes about 11 s, above the NFR01-startup ceilingFound by X18-vsock-handoff (#29).).
- Failed candidates: the host-written daemon didn’t answer in 150 s (first boot) and the LaunchAgent variants didn’t in 300 s each.
- Project users: the test daemon created a user with
sysadminctl -addUserandcreatehomedir, andsysadminctl -deleteUserremoved its home but not its record (eDSPermissionError), on the sealed image.wb-guestdremoves project users (S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does.), so that is filed as I138I138 (closed): S06-vm-lifecycle: wb-guestd can't delete a macOS user record (eDSPermissionError)S06-vm-lifecycle says wb-guestd creates, locks and removes project users..
What was not measured
Section titled “What was not measured”- Root on the host. Writing root-owned files from the host needs
sudo, which SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. rules out at run time. - SSH without a NAT network (open decision 2, I139I139 (closed): S06-vm-lifecycle: SSH for the image build's provisioning boot without a NAT networkX17-image-build (#28) answered "no": a host without root can't get wb-guestd into a new macOS guest by writing to its disk.).
- Why the user’s own LaunchAgent didn’t run. Unified log entries of the guest weren’t readable on the host, and the spike stopped that path once SSH worked.
- The base layer’s tools. Homebrew and the Xcode command line tools need the network through the egress gateway, which this spike didn’t have.
- The Network Extension approval of S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection. during the build, which waits for X14-flow-attributionX14-flow-attribution: Guest flow attributionA Network Extension transparent proxy in a macOS guest (S13-guest-confinement): can it be approved during the image build without MDM?.
What it means for the specs
Section titled “What it means for the specs”- S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does., “Images”: “Built by Wraith Box” now describes
the provisioning boot, the one SSH session, and the hand-over to
wb-guestd, and says the host never mounts a guest disk to build an image. “Sealing” lists the checks of condition 5 (changed in this pull request). The rest of S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does. is unchanged, because I46I46 (closed): S05-cli, S06-vm-lifecycle: session lifecycle, detach, sleep and failureS05-cli and S06-vm-lifecycle describe starting a session and its summary at the end, but not what happens in between, or when things go wrong: edits its session parts. - S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves. doesn’t change in this pull request. Where the provisioning password lives is I145I145 (closed): SEC12-least-privilege: who holds the image build provisioning password (X17)X17-image-build (PR #141, #28) found that the image build needs a provisioning password: - wb-vmd sets it on VZMacGuestProvisioningOptions; - the build's one SSH session uses it; - wb-guestd's disable step needs the… (open decision 4).
- NFR04-host-platformsNFR04-host-platforms: Host platformsFirst target: Apple Silicon, macOS 27 or later, because wb image build needs the guest provisioning options that are new in macOS 27 (X17-image-build). says macOS 15 or later, and this build needs macOS 27 (open decision 3). This pull request leaves it as it is until that is decided.
- S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…, “Spikes”: the list of answered spikes should name X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM?. I50I50 (closed): Test infrastructure for work that needs a running macOS guestMost v1 work needs a running macOS guest to test: spikes X02-warm-start to X08-data-disk and X17-image-build to X20-shared-homebrew, the conformance suite, and the benchmarks (S11-verification-and-spikes). edits that file in the same wave, so it’s left to I140I140 (closed): S11-verification-and-spikes: list the X17-image-build resultThe done-when of #28 asks S11-verification-and-spikes, "Spikes", to point to the X17-image-build result..
- S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice.: the install reads the restore image from a local
file, so
wb-vmddoesn’t need a network for it. Who downloads it stays with I49I49 (closed): S10-tech-stack: installation, restore image download, upgrades and migrationsS10-tech-stack "Packaging and signing" gives the shape of the macOS app bundle..
Spike code
Section titled “Spike code”Branch spike/x17-image-build, at
6d3ff44:
the Swift wb-vmd stand-in, the Go guest daemon, the host-side Data
volume scripts, the provisioning script, the scan and cleanup scripts,
and the raw results in results/, with passwords redacted. The
spike’s bundles (base and e1 to e5) are spike artifacts, and no
product image may descend from them.
Status: Answered 2026-10-07: no