Can wb-vmd confine itself and still run a macOS VM?
Answered 2026-10-06. Decided 2026-10-12: 1A and 2A. The decisions are in the I64I64 (closed): X25-vmd-sandbox: Self-sandboxed wb-vmdFound while answering #34 (X23-sandboxed-daemons). comment that starts Decision (2026-10-12):, which also makes the install target a fixed build bundle. The spec changes are I218I218 (closed): S04-architecture, S06-vm-lifecycle: one wb-vmd per VM and a fixed install entry, from B64-vmd-sandboxThe maintainer decided the two points of B64-vmd-sandbox on 2026-10-12, in the #64 comment that starts Decision (2026-10-12):.. Source: 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?, I64I64 (closed): X25-vmd-sandbox: Self-sandboxed wb-vmdFound while answering #34 (X23-sandboxed-daemons).. Affects S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., 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., S07-egress-gatewayS07-egress-gateway: Egress GatewayThe only path from a guest to any network: a userspace network stack (wb-netd) and a policy-enforcing proxy (wb-proxyd) on the host., 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… and 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..
The picture
Section titled “The picture”Figure 1. wb-vmd confines itself after wb-launcher starts it, and keeps access to the VM bundles and Apple’s Virtualization service. The profile refuses a shared host directory, because sharing one needs a sandbox extension the profile denies (SEC02-no-host-fs-shareSEC02-no-host-fs-share: No host filesystem sharingNo host directory is mounted into the guest, read-only or otherwise.). The service provides a NAT network without any help from wb-vmd’s process. Only wb-vmd’s own check keeps that network from the guest (SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.).
Options
Section titled “Options”The spike settled the mechanism: a Seatbelt profile in process, as for the Go daemons. App Sandbox wasn’t needed, and no confinement would weaken SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts. (Details). You choose how many wb-vmd processes run, and how one starts to install an image.
Decision 1: how many wb-vmd processes
Section titled “Decision 1: how many wb-vmd processes”Decision 2: how wb-vmd is started to install an image
Section titled “Decision 2: how wb-vmd is started to install an image”Impact
Section titled “Impact”Evidence
Section titled “Evidence”- verified Under the profile, a Swift
wb-vmdstand-in installed macOS from a restore image (240 s), cold booted to the guest daemon answering on vsock, saved, and restored. Right after confining, the profile denied it reading/etc/passwd, writing in/tmp, connecting over TCP, and starting a program (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?, “Boot, save, restore, install, hand-off”;install-confined.jsonl,final-boot-save.jsonl). - verified A boot without any one of the rules fails with a named error. The two exceptions are the CPU name and the framework bundle, which conditions 2 and 3 of the result explain (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”;
ablate-v5.txt,ablate-split.txt). - verified 10 restores confined and 10 unconfined, alternating, each from a fresh clone: 3.40 s median both ways. The guest answered on vsock at 3.60 s median both ways (
series.txt). - verified A state saved while the CPU name was denied failed to restore with “invalid argument” in an unconfined process, and the other way round, in all 9 tries. With the CPU name allowed, states restore both ways (
series-cpu-name-denied.txt,addon-round2.txt). - verified A shared directory, the host microphone, and a disk or serial log file outside
<data>/vmsare refused under the profile and start unconfined. Unconfined, the guest read a secret file through the share and saw the extra disk (devices-final.txt,devices-unconfined.txt,guest-unconfined-check.txt). - verified With a NAT network, the confined
wb-vmd’s guest fetchedhttps://www.apple.com/(HTTP 200) (guest-confined-nat-check.txt). - verified A bridged network failed both ways. Confined, the framework offered no host interface to bridge to. Unconfined, it offered one and refused the attachment without the
com.apple.vm.networkingentitlement (dev-final-bridged.jsonl,dev-unconfined-bridged.jsonl). - verified A vsock descriptor passed with
SCM_RIGHTSout of the confined process still talks to the guest (final-handoff.jsonl). - inferred The SPICE clipboard device can’t reach the host clipboard under the profile, because the pasteboard lookup is denied. The guest had no SPICE agent to show it (
dev-final-spice.sandbox.txt). - assumed That the profile works the same for the release build with the hardened runtime and a Developer ID signature. The spike was ad-hoc signed (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?, “Not covered”). I118I118 (open): wb-vmd sandbox profile under the hardened runtime and a Developer ID signatureFound while answering #64 (X25-vmd-sandbox). checks it.
- verified The read-write extension on the cache directory, narrowed to the
com.apple.metal-andcom.apple.paravirtualizedgraphics-entries, is enough for boot, save and restore (narrow-boot-save.jsonl,narrow-restore.jsonl). - assumed That the extension classes fit the final device set. They were measured with the X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest? devices, including a graphics device and a USB keyboard and pointer, and are ablated again when 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. fixes the set.
- inferred That a compromise of one
wb-vmdcan reach every bundle its profile allows: the profile is the only limit on the process’s file access (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”). - assumed That Apple keeps
sandbox_init_with_parametersworking (as in 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…).
What this unblocks
Section titled “What this unblocks”- The
wb-vmdimplementation inpackages/wraithbox-swift: its profile, the configuration check against the fixed device set, a unit test that passes each refused device to that check, and the static CI check that rejects the NAT, bridged, shared directory, SPICE and audio input classes inwb-vmd’s sources. - I28I28 (closed): X17-image-build: Unattended image buildX17-image-build (added to S11-verification-and-spikes in #14) (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?): the image build can run in a confined
wb-vmd, with the three install rules. - The V1-M1-spikes-closedV1-M1-spikes-closed: Spikes answered and spec gaps closedX01-model-credential to X09-keychain-unsigned and X17-image-build to X28-git-alloc-limit written up in docs/spikes/, the spec issues of the first implementation plan decided, and specs updated. exit criterion: one fewer open spike.
Details and glossary
Why NAT gets past the profile. A Seatbelt profile limits what a process does itself: which files it opens, which services it looks up. The Virtualization framework runs the VM in a separate service process that Apple confines with its own profile. For most devices, wb-vmd hands that service a sandbox extension: a token that grants access to a file or a device class. The profile decides which tokens wb-vmd may issue. A NAT network doesn’t need a token, because the service sets it up with Apple’s vmnet on its own. So wb-vmd’s profile has nothing to deny.
Other ways to confine wb-vmd. App Sandbox, set by entitlements at signing, would confine wb-vmd at launch with a container directory. It wasn’t tried, because the in-process profile works. Leaving wb-vmd unconfined would give a bug in it all the user’s files and the network, and would need a spec change, since it weakens SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts..
What the device-set check does. Before every start and restore, wb-vmd compares its own description of the VM with the fixed list in 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., before it creates any Virtualization object, and refuses anything else with the rule in its log and in the error it returns. It runs first because a disk outside the bundle crashes the confined process when the framework tries to open it. A unit test passes it each refused device, a conformance check in the guest looks for exactly one network interface, and a CI check rejects the NAT, bridged, shared directory and audio input classes in wb-vmd’s code (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…, S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.).
Why the CPU name matters. The framework writes facts about the host into the saved state, among them the CPU name, which it reads with sysctl. When the profile denies that read, the saved state records a different value from what an unconfined process sees. The restore then fails with “invalid argument”. With the read allowed, states restore between a confined and an unconfined process in both directions (measured), so a later profile change is less likely to strand them. 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 treats an unexplained “invalid argument” as permanent: the state is deleted and the VM cold boots.
What wb-vmd does before confining. It asks for its cache directory with confstr. libSystem gets the answer from a system service once and keeps it, so the framework’s later call works without that service. Nothing guest-controlled is read before confining.
Glossary
- Seatbelt: the macOS kernel sandbox. A profile lists what a process may do, and the kernel denies the rest.
- Sandbox extension: a token one process issues to give another access to a file or a class of device. The issuing process’s profile decides which tokens it may issue.
- NAT network: a virtual network where the host’s network stack translates the guest’s addresses and forwards its traffic to the internet.
- virtio-fs: the device that shares a host directory with the guest.
- vsock: the socket between host and guest that
wb-hostdandwb-guestdtalk over. - Restore image: the file Apple publishes to install macOS into a VM.