X23 - Self-sandboxed Go daemons on macOS
Purpose: Find out whether wb-netd, wb-proxyd and wb-hostd can
confine themselves with a sandbox profile at start, as S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.
says, without breaking the Go runtime or the work each one does.
Requirements: SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts., and the “Each host daemon is self-sandboxed” decision of S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.
For review
Section titled “For review”wb-proxyd with the Keychain and the Secure Enclave (I61)
Section titled “wb-proxyd with the Keychain and the Secure Enclave (I61)”- Decides: the
wb-proxydprofile, and with it the store-only profile ofwb-credsetandwb-guestadmin. - You are approving: the answer “yes”. A team-signed
wb-proxydwith thebindingandcaaccess groups confines itself and still writes, reads and deletes a binding item, makes a wrapped Secure Enclave key, keeps its token object ID in a CA item, restores it and signs, and fetches over TLS checked against the system roots. The profile adds three rules to the network part from I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14): two Mach services,com.apple.securityd.xpcandcom.apple.ctkd.token-client, and a metadata read of the helper’s own bundle directory, which certificate checks need. Files, listening, starting programs, UDP other than DNS, another access group and the login keychain stay denied. The Keychain and Secure Enclave services alone make the store-only profile. - 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., kept. The profile can’t
name Keychain items. Which items
wb-proxydreaches is set by the access groups in its code signature (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.), and the profile decides only whether it reaches the store at all. - Assumed: that what sandboxd didn’t report doesn’t matter. It
reported only some denials. The TLS rules came from removing rules
one at a time from the wide I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14) profile until the check failed, not
from the log. A code path the probes didn’t run, such as an OCSP
answer that
trustdcan’t fetch itself, may need more. Only arm64 ran, on one macOS version. - Decisions: none open.
- Brief: B61-proxyd-keychainB61-proxyd-keychain: Can a self-sandboxed wb-proxyd still use its Keychain items and Secure Enclave keys?Yes.
Self-sandboxed daemons (I34)
Section titled “Self-sandboxed daemons (I34)”- Decides: how a Go daemon confines itself on macOS, the profiles
for
wb-netdandwb-hostd, and howwb-hostdstarts the other daemons and git so that each can confine itself. - You are approving: each daemon applies its own Seatbelt profile
in process with no cgo.
wb-netdruns under a profile that denies everything.wb-hostdgets its state directories and its socket. With open decision 1, you also choose how the other daemons start. S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves. 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. describe the recommended option. - 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. (least privilege on the
host): kept under option A with the launcher conditions below.
Options B and C weaken it. No other
SEC*control changes. - Assumed: that Apple keeps
sandbox_init_with_parametersworking. The SDK header markssandbox_initdeprecated since macOS 10.8 and doesn’t declare the variant with parameters at all. Both still work on macOS 27.0.1. Only arm64 was run. The amd64 build compiles and was not run. The launcher conditions and thewb-gitshim are proposals the spike didn’t build. - Open decisions:
- How
wb-hostdstartswb-vmd,wb-netdandwb-proxyd, given that a confined process can’t confine its children further: A, a launcher started beforewb-hostdconfines itself (recommended), B, children inherit thewb-hostdprofile, C,wb-hostdstays unconfined, D, each daemon as its own launchd job. B34-sandboxed-daemonsB34-sandboxed-daemons: Can the Go daemons confine themselves on macOS?Yes, with conditions. compares them. - How git is confined, under option A: a
wb-gitshim that applies a profile for one repository and then runs git (recommended, untested), or git inheriting thewb-hostdprofile (measured, weaker, residual risk under condition 4, recorded in T00-indexT00-indexboundary 6 is the host terminal stream. if chosen).
- How
- Brief: B34-sandboxed-daemonsB34-sandboxed-daemons: Can the Go daemons confine themselves on macOS?Yes, with conditions.
Question
Section titled “Question”Can wb-netd, wb-proxyd and wb-hostd confine themselves at start
with a sandbox profile, as S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves. says, while the Go runtime,
inherited descriptors, and Keychain and Secure Enclave access in
wb-proxyd keep working?
This result covers approach steps 1 and 2 of I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14). Step 3, the
wb-proxyd profile with Keychain and Secure Enclave access, is I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.,
in “wb-proxyd with the Keychain and the Secure Enclave (I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.)”.
Answer
Section titled “Answer”Yes, with conditions.
| Daemon | Answer | Profile |
|---|---|---|
wb-netd |
Yes | (deny default) and nothing else |
wb-hostd |
Yes, with conditions | its state directories, its Unix socket, and running git |
wb-proxyd |
Yes (I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.) | outbound TCP, DNS, certificate checks, the Keychain and the Secure Enclave |
The conditions:
-
In process, without cgo. The daemon calls
sandbox_init_with_parametersfromlibsystem_sandboxas its first act inmain. A Go assembly trampoline makes the call, the waygolang.org/x/sys/unixcalls the C library. The binary builds withCGO_ENABLED=0and cross-compiles from any OS. The cgo version behaves the same. Starting the daemon undersandbox-execalso works but needs a larger profile (below). Nothing before the call reads an inherited descriptor, the arguments or the environment. Right after the call, the daemon tries one operation its profile denies, and exits if that succeeds.wb-hostdis the exception to “first act inmain”: condition 6 lists what it does first. -
Set
GOMAXPROCSbefore confining. Go 1.25 and later re-read the CPU count (hw.ncpu) every second to adjustGOMAXPROCS. When the profile denies the read, the runtime sees one CPU, setsGOMAXPROCSto 1, andwb-netdthroughput drops by about 40 percent. An explicitruntime.GOMAXPROCS(runtime.NumCPU())before the call turns that update off, andGOMAXPROCSstays at 8 under a bare(deny default). The security review on PR65PR65 (merged): docs(spike): X23-sandboxed-daemons result, yes with conditionsResult of spike X23-sandboxed-daemons, approach steps 1 and 2 (the scope set by the 2026-10-04 decision on #34). found this, and the spike repeated it. Allowingsysctl-readofhw.ncpuworks too. The explicit call is recommended because it keeps thewb-netdprofile empty and doesn’t depend on which value the runtime reads. -
wb-hostdstarts its children through a launcher (option A). A confined process can’t apply a second profile: the kernel refuses it (forbidden-sandbox-reinit), and children inherit their parent’s profile. Sowb-hostdstarts a launcher,wb-launcher, before it confines itself, and each program the launcher starts confines itself. The spike’s launcher showed that this works, but it was looser than this (it passed arguments and the environment, and read requests from a stream socket). A launcher that doesn’t widen what a compromisedwb-hostdcan do needs all of these:- It is a separate, small program that uses only the Go standard
library. It isn’t
wb-hostdstarted again in another mode, which would run theinitcode of everywb-hostddependency unconfined. - Its request channel is a
SOCK_SEQPACKETorSOCK_DGRAMsocketpair inherited at start, never a path. It takes one fixed-format request per message. A request with unexpected descriptors has them closed and is refused. - It starts each program with no arguments and a fixed environment.
The one bounded exception is the repository for
wb-git(condition 4). - Each program’s profile and its parameters are compiled into the
program, or come from configuration that
wb-hostdread before it confined itself. They never come over the request channel. - Its program table holds absolute paths in the installed bundle,
never under
<config>,<data>or<logs>, and it checks that when it starts. - Each program has an instance cap (SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.).
- It is a separate, small program that uses only the Go standard
library. It isn’t
-
git gets its own profile (proposal), or inherits
wb-hostd’s (measured). In the spike, git ran as a child of the confinedwb-hostdand inherited its profile. That works, but a bug ingit receive-pack, which parses packs the guest builds, would then have every right ofwb-hostd. It could read every project’s policy, change approvals instate.db, write other projects’ landing repositories, and alter the audit log. The proposal: awb-gitshim thatwb-launcherstarts, which applies a profile for one repository and then runs git. That profile allows reading the git installation and writing that one repository. The spike didn’t build it.The repository and the git subcommand differ per request, so
wb-gitis the one bounded exception to the launcher’s “no arguments” rule:- The launcher table has two fixed entries,
wb-git-receiveandwb-git-upload, so the subcommand is never a free string. - Besides its program, the request holds one field, the repository.
wb-launchertakes the real path of the projects root (<data>/projects, from configurationwb-hostdread before it confined itself) once, when it starts. It accepts the repository only if it equals, after cleaning,<real path of the projects root>/<id>/<basename>, with<id>in the project ID format and<basename>eitherlanding.gitorexport.git(I41I41 (closed): S08-workspace-and-git: which git data reaches the guest, and host git as a parserS08-workspace-and-git says how bytes move, but not which data the guest may get or how much the host trusts its own git when it parses guest data:). It never resolves the request string itself, which would follow a symbolic link an attacker placed. - The shim repeats the same check before it calls
sandbox_init. - The repository becomes the shim’s profile parameter and git’s one path argument.
- Seatbelt matches resolved paths. The security review on PR65PR65 (merged): docs(spike): X23-sandboxed-daemons result, yes with conditionsResult of spike X23-sandboxed-daemons, approach steps 1 and 2 (the scope set by the 2026-10-04 decision on #34). reproduced that a symbolic link swapped in after the check is denied, not followed to the new target. That Seatbelt match is the control that matters, and the path check is defense in depth.
- Instead of a path,
wb-hostdcould hand over an inherited directory descriptor that the launcher checks withF_GETPATH, which keeps the path out of the request.
If the maintainer chooses the fallback instead, git under the
wb-hostdprofile is recorded in T00-indexT00-indexboundary 6 is the host terminal stream. as an accepted residual risk. Either way:- The profile allows only the git installation:
bin/git,libexec/git-core/,share/git-core/and the libraries git links. Homebrew git linkspcre2andgettextthrough/opt/homebrew/opt/<lib>, a symbolic link into/opt/homebrew/Cellar/<lib>/<version>. Seatbelt matches resolved paths. Each library needs two rules:file-read-metadataon the/opt/homebrew/opt/<lib>literal, andfile-read*on the resolved Cellar subpath, with the real path resolved before confining (the security review on PR65PR65 (merged): docs(spike): X23-sandboxed-daemons result, yes with conditionsResult of spike X23-sandboxed-daemons, approach steps 1 and 2 (the scope set by the 2026-10-04 decision on #34). reproduced this).process-execcan be limited togit,git-receive-packandgit-upload-pack. The spike allowed all of/opt/homebrewor the whole Xcode developer directory, which is wider than git needs. wb-hostdresolves the/usr/bin/gitshim to the real binary before it confines itself.- git runs without the user’s or the system’s git configuration, in a
working directory inside
<data>, with the repository directories created before it runs.
- The launcher table has two fixed entries,
-
Profiles take paths as parameters. Generated rules, such as the ones for each parent directory of
<data>(below), name parameters ((param "PARENT1")), and the paths go in as parameter values. The spike pasted the paths into the profile text instead. The security review on PR65PR65 (merged): docs(spike): X23-sandboxed-daemons result, yes with conditionsResult of spike X23-sandboxed-daemons, approach steps 1 and 2 (the scope set by the 2026-10-04 decision on #34). showed that a crafted path then turns the profile off, so the daemon runs unconfined. -
What
wb-hostddoes before it confines itself. It reads its own configuration, setsGOMAXPROCS, loads the local time zone, starts the launcher, resolves the git binary, and works out the paths and parameters for its profile. None of that reads anything the guest sent. -
Each daemon fails closed. A profile that doesn’t compile, or a missing parameter, makes the call fail and the daemon exit.
Measurements
Section titled “Measurements”Host: macOS 27.0.1 (26A434), Apple Silicon, Go 1.27.1. The spike code
and its recorded output are on the spike branch:
spikes/x23-sandboxed-daemons at 6602ecb,
and the GOMAXPROCS check after review at
00c2119
(results/ holds the output of each run).
What a confined Go program can still do
Section titled “What a confined Go program can still do”A probe program applied each profile to itself and then tried each
operation. Under deny-all.sb ((deny default) and nothing else),
applied in process:
| Works | Denied |
|---|---|
| goroutines, garbage collection, returning memory to the OS, async preemption, timers | opening any file, /etc/passwd, the home directory, /tmp |
crypto/rand, ECDSA signing |
stat of any path, os.Getwd, os.Hostname |
| inherited descriptors: stderr, sockets | TCP and UDP connect, also to loopback |
socketpair and passing descriptors with SCM_RIGHTS |
connecting to a Unix socket by path, listen |
| DNS lookups, running a program, signals to other processes | |
Mach service lookups the system libraries try: com.apple.logd, com.apple.system.notification_center, com.apple.system.opendirectoryd.libinfo |
|
sysctl reads such as kern.hostname and kern.ipc.somaxconn |
The profile applies to every thread of the process, including the ones the Go runtime started before the call. A file open from 32 goroutines, each locked to its own OS thread, was denied on all 32.
time.Local becomes UTC, because the time zone file can’t be read. A
daemon that needs local time loads it before it confines itself.
wb-netd: gVisor over inherited descriptors
Section titled “wb-netd: gVisor over inherited descriptors”A stand-in for wb-netd confined itself, then ran a gVisor stack on an
inherited datagram socket with one Ethernet frame per datagram (as the
file-handle network attachment uses). For each TCP connection from a
guest stack on the other end, it made a socketpair, passed one end to a
proxy over an inherited Unix socket with SCM_RIGHTS, and copied the
stream to the other end. The proxy echoed. Each run sent 64 MiB each
way on each of 4 streams:
| Mechanism | Profile | Echo throughput |
|---|---|---|
| not confined | none | 420 MiB/s, median of 5 |
| in process, no cgo | netd.sb (hw.ncpu allowed) |
438 MiB/s, median of 5 |
| in process, cgo | netd.sb |
418 MiB/s, median of 5 |
sandbox-exec |
netd-exec.sb |
439 MiB/s, median of 5 |
| in process, no cgo | (allow default) |
404 MiB/s, median of 5 |
| in process, no cgo | deny-all.sb |
258 MiB/s, median of 3 |
in process, no cgo, explicit GOMAXPROCS |
deny-all.sb |
437 MiB/s, median of 3 (runs: 437, 314, 458) |
| in process, no cgo, same session | netd.sb |
472 MiB/s, median of 3 |
All streams arrived complete. The differences between the rows other
than plain deny-all.sb are within the noise of a shared machine. The
call took 5.36 to 9.26 ms in the recorded runs.
The recommended wb-netd profile is the bare one, with GOMAXPROCS
set before the call:
(version 1)(deny default)Under it, the stand-in couldn’t open, write or stat a file, connect
over TCP, UDP or a Unix socket path (also to a listener in the same
test), listen, resolve a name, or run a program. Its log goes to an
inherited descriptor: a pipe or socket to wb-hostd, never a
descriptor on a file in <logs> or <data>. A profile is checked when a
file is opened, not on each write, so an inherited file descriptor
would keep working under any profile.
In process or sandbox-exec
Section titled “In process or sandbox-exec”| In process | sandbox-exec |
|
|---|---|---|
| Profile | the rules the daemon needs | those, plus loading the binary: running it, reading it, /usr/lib, the dyld cache, and the sysctl values the Go runtime reads at start |
| cgo | not needed | not needed |
| Who chooses the profile | the daemon, from a profile compiled into it | its parent, on the command line |
| Apple’s status | sandbox.h marks sandbox_init “No longer supported” since 10.8, and doesn’t declare sandbox_init_with_parameters |
the man page says “DEPRECATED” |
sandbox-exec with (deny default) alone can’t start the program at
all (execvp() ... Operation not permitted). The extra rules let any
code in the process read /usr/lib and the system libraries until it
exits. In process, the profile only has to allow what the daemon
does after start.
The variant with parameters takes paths such as <data> as values that
the profile reads with (param "DATA"), so paths stay out of the
profile text (condition 5).
Both interfaces are deprecated and both still work. Apple points developers at App Sandbox, which is set by entitlements at signing time. Its entitlements switch capabilities on or off (network client, for example) and give the program a container directory. This spike didn’t try it.
wb-hostd: state, IPC and git
Section titled “wb-hostd: state, IPC and git”A stand-in for wb-hostd confined itself to its directories
(parameters CONFIG, DATA, LOGS), then:
| Check | Result |
|---|---|
read <config>/config.toml |
allowed |
write in <config> |
denied |
create, lock (flock) and write <data>/state.db |
allowed |
append to <logs>/audit.jsonl |
allowed |
listen on a Unix socket in <data>/run, serve a client outside the sandbox |
allowed |
| read or write outside its directories, TCP or UDP out, DNS, listen on TCP | denied |
git round trip with Homebrew git: init --bare, commit, push (receive-pack), clone (upload-pack) |
works |
the same with the Xcode git binary, found with xcrun --find git before confining |
works |
the same through the /usr/bin/git shim |
fails: the shim runs xcode-select, which reads /var/select/developer_dir |
start a wb-netd child that confines itself |
fails: forbidden-sandbox-reinit |
| the same through a launcher started before confining | works, and the child’s profile holds |
ask the launcher for a program not in its table (sh) |
refused |
git needed these from the profile and from wb-hostd:
- Running and reading the git installation, and
/dev/null. - No user or system git configuration:
GIT_CONFIG_NOSYSTEM=1,GIT_CONFIG_GLOBAL=/dev/nullandHOMEset to a state directory. git treats a denied~/.config/git/configas an error and stops. The git gateway must not use the user’s git configuration in any case. - Metadata reads (
stat) of each parent directory of<data>, because git resolves real paths from the root. A profile has no rule for “the parents of a path”, so the profile needs one rule for each parent, with the path as a parameter (condition 5). - A working directory inside
<data>, and the repository directories created bywb-hostdbefore git runs.
The local push and clone in the test start git-receive-pack and
git-upload-pack through /bin/sh, which the test profile allowed.
The git gateway runs them directly (S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem.), so the real
profile doesn’t need a shell.
The profile that ran, without the generated parent rules and without the
NETD rules that let the spike start wb-netd directly:
(version 1)(deny default)(allow sysctl-read (sysctl-name "hw.ncpu"))(allow file-read* (subpath (param "CONFIG")))(allow file-read* file-write* (subpath (param "DATA")) (subpath (param "LOGS")))(allow network-bind network-inbound (local unix-socket (subpath (string-append (param "DATA") "/run"))))(allow process-fork)(allow process-exec (literal (param "GIT")))(allow process-exec file-read* (subpath (param "GITROOT")))(allow file-read* file-write-data (literal "/dev/null")); git starts under this profile, so dyld must load it.(allow file-read* (literal (param "GIT")))(allow file-read* (literal "/") (subpath "/usr/lib") (subpath "/System/Library/dyld") (subpath "/System/Cryptexes/OS"))(allow file-read-metadata (subpath "/System/Volumes/Preboot/Cryptexes"))(allow sysctl-read (sysctl-name "hw.pagesize" "hw.pagesize_compat" "hw.logicalcpu_max" "hw.physicalcpu_max" "kern.osrelease" "kern.osversion"))GITROOT was /opt/homebrew or /Applications/Xcode.app/Contents/Developer.
Condition 4 narrows it to the git installation. That narrower rule set
was not run.
SQLite itself was not run. state.db stands for it with a file lock
and a write.
wb-proxyd: the network part
Section titled “wb-proxyd: the network part”This is the part of wb-proxyd that doesn’t use the Keychain. I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.
added the rest, in “wb-proxyd with the Keychain and the Secure Enclave
(I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.)”.
- Outbound TCP and DNS work under a short profile:
network-outboundto TCP, UDP to port 53, reading/private/etc/resolv.confand/private/etc/hosts, and connecting to/private/var/run/mDNSResponder, which Go’s resolver uses through libSystem on macOS (profiles/proxyd-net.sb). - Checking a server certificate against the system roots fails under
that profile (
SecPolicyCreateSSL error: 0). It works once the profile also allows thetrustd,SecurityServer,cfprefsdandocspdservices, reading the Security framework and the system keychains, and everystatandsysctlread (profiles/proxyd-net-tls.sb). That profile is too wide, and I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04. must not start from it as it is.
What it means for the specs
Section titled “What it means for the specs”- S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “Processes”, and S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS., “Each host daemon is self-sandboxed”: the launcher under option A with its conditions, the
self-check,
wb-hostdas the exception, and thewb-netdlog descriptor. - S12-01-platform-interfacesS12-01-platform-interfaces: Platform InterfacesHow platform-specific code is isolated behind interfaces, and what each host OS uses for each., “Self-sandbox” row for macOS: a Seatbelt profile
applied in process with
sandbox_init_with_parameters, without cgo, and the launcher. - A proposal for I48I48 (closed): S04-architecture: process supervision, failure, version skew and host resource limitsS04-architecture names the processes but not how they are supervised, what happens when one fails, or how they are upgraded:’s supervision section in S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.: the
launcher is the parent of
wb-vmd,wb-netdandwb-proxyd. It sees their exits and must pass them on towb-hostd. I48I48 (closed): S04-architecture: process supervision, failure, version skew and host resource limitsS04-architecture names the processes but not how they are supervised, what happens when one fails, or how they are upgraded: must also decide what happens to the launcher and its children whenwb-hostdrestarts, so no orphaned daemons keep running. - I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04. starts from
proxyd-net.sb. wb-vmdconfines itself too (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.). With the launcher it can, but its profile for the Virtualization framework was not part of this spike (I64I64 (closed): X25-vmd-sandbox: Self-sandboxed wb-vmdFound while answering #34 (X23-sandboxed-daemons).).
wb-proxyd with the Keychain and the Secure Enclave (I61)
Section titled “wb-proxyd with the Keychain and the Secure Enclave (I61)”Question
Section titled “Question”From I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.: can wb-proxyd run under a profile that allows outbound
network, its Keychain items and Secure Enclave signing, and denies the
rest?
I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04. was filed before B23-keychain-unsignedB23-keychain-unsigned: How do development builds without a signing identity keep their Keychain items and their CA key?Between updates the access-control list works, but after each update every item asks for a password nobody knows. and B248-dev-signingB248-dev-signing: Can development builds signed by the developer's own team share Keychain items across an update?Yes, with conditions. were
decided, and asked for a throwaway keychain file. Since those
decisions, wb-proxyd keeps its items in the data protection keychain
behind access groups of the team that signed the build
(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 spike measured that setup.
Answer
Section titled “Answer”Yes. The profile:
(version 1)(deny default)(allow network-outbound (remote tcp))(allow file-read-metadata (literal "/etc") (literal "/var"))(allow file-read* (literal "/private/etc/resolv.conf") (literal "/private/var/run/resolv.conf") (literal "/private/etc/hosts"))(allow network-outbound (remote udp "*:53"))(allow network-outbound (literal "/private/var/run/mDNSResponder"))(allow mach-lookup (global-name "com.apple.trustd.agent"))(allow file-read-metadata (literal (param "BUNDLE")))(allow mach-lookup (global-name "com.apple.securityd.xpc" "com.apple.ctkd.token-client"))BUNDLE is the real path of the helper’s bundle directory,
.../Contents/Helpers/wb-proxyd.app, worked out before the daemon
confines itself (condition 5).
com.apple.securityd.xpcis the data protection keychain, andcom.apple.ctkd.token-clientthe Secure Enclave token. They are enough for every store callwb-proxydmakes (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., “Declared access”), without a file rule.- Certificate checks against the system roots need
com.apple.trustd.agentand the metadata of the helper’s own bundle directory.com.apple.trustd,SecurityServer,cfprefsd,ocspd, the Security framework files, the system keychains, every otherstatand everysysctlread in the wide I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14) profile could each be removed. - The
hw.ncpurule of the network part isn’t needed, because the daemon setsGOMAXPROCSbefore it confines itself (condition 2). - The Keychain and Secure Enclave services alone make the store-only
profile: the Keychain and the Secure Enclave work, and DNS and TLS
fail. S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves. gives that profile to
wb-credsetandwb-guestadmin.
Host: macOS 27.0.1 (26A434), Apple M2, Go 1.27.1, Xcode 27.0. The
helper was built as in X29-dev-signingX29-dev-signing: Keychain access group for development buildsCan a developer's free personal team, an Apple ID signed in to Xcode without a paid membership, sign the helpers in Wraith Box.app (wb-proxyd, wb-hostd, wb-vmd) with a keychain-access-groups entitlement and a provisio…: a cgo binary as the main
executable of Contents/Helpers/i61.app, with the profile embedded,
signed with the hardened runtime by the team G7BF23LV79 and holding
the groups G7BF23LV79.nl.wraithbox.binding and
G7BF23LV79.nl.wraithbox.ca. It confined itself with the no-cgo call
from condition 1, which also works inside a cgo binary, then checked
that /etc/passwd couldn’t be opened, then ran each probe. No dialog
appeared at any step.
| Probe | Unconfined | Network part only | Final profile |
|---|---|---|---|
write, read, delete binding/ item |
works | fails: -25291 | works, 0.4 to 5 ms |
new Secure Enclave key, token object ID into a ca/ item |
works | fails: -26276 | works, 13 ms |
read the ca/ item, restore the key, sign, verify |
works | fails: -25291 | works, 5 ms |
delete the ca/ item |
works | fails | works |
read an item in the group nl.wraithbox.store |
-34018 | -25291 | -34018 |
| list the file-based keychains, attributes only | 166 items | -50 | -50 |
| DNS lookup | works | works | works |
TLS GET of api.anthropic.com, system roots |
works | fails: SecPolicyCreateSSL error: 0 |
works |
open /etc/shells, the home directory, login.keychain-db |
works | denied | denied |
write in /tmp |
works | denied | denied |
listen on loopback TCP, or on a Unix socket in /tmp |
works | denied | denied |
| UDP to port 123 | works | denied | denied |
run /bin/echo |
works | denied | denied |
The final profile ran four times with the same result. Applying it took 5 to 8 ms in the recorded runs.
-34018 is errSecMissingEntitlement. The code signature refuses the
other group, under a profile and without one. The profile, not the
signature, keeps the login keychain out. Unconfined, the helper saw the
attributes of its 166 items.
How the profile was found
Section titled “How the profile was found”sandboxd reported only three violations for the network-part run, the
two Mach services above and com.apple.analyticsd, and none for the
failed certificate check. On macOS 27 the reports come from sandboxd,
not from the kernel’s Sandbox sender that I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14) read. With the two
services added, the store worked. For the certificate check a script
took the wide I34I34 (closed): X23-sandboxed-daemons: Self-sandboxed Go daemons on macOSX23-sandboxed-daemons (added to S11-verification-and-spikes in #14) TLS rules, one rule per name or path, and dropped
each one whose removal still let the TLS probe pass twice in a row.
Then it did the same for the paths under /Users that the remaining
file-read-metadata rule needed.
com.apple.analyticsd stays denied, and nothing failed for it.
Limits
Section titled “Limits”- The probes didn’t make revocation checks happen. If one needs a
service the profile denies, the certificate check fails and
wb-proxydrefuses the connection, which fails closed. - A locked screen wasn’t tried. The Secure Enclave key is usable only while the Mac is unlocked, and S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded. already says what happens when the store is locked.
- The helper was started from a shell, not through
wb-launcher. X29-dev-signingX29-dev-signing: Keychain access group for development buildsCan a developer's free personal team, an Apple ID signed in to Xcode without a paid membership, sign the helpers in Wraith Box.app (wb-proxyd, wb-hostd, wb-vmd) with a keychain-access-groups entitlement and a provisio… showed that how a helper starts doesn’t change its Keychain access. - One Mac, arm64, one macOS version.
What it means for the specs
Section titled “What it means for the specs”- S04-03-self-sandboxingS04-03-self-sandboxing: Self-SandboxingHow each host daemon confines itself at startup, and the wb-launcher that starts confined programs on macOS., “Each host daemon is self-sandboxed”:
wb-proxydalso reads the metadata of its own bundle directory, and “the secret store service” in thewb-credsetandwb-guestadminprofiles is the two Mach services above. I261I261 (closed): docs(spec): wb-proxyd and store-only self-sandbox profiles from X23 I61The result of #61 (X23-sandboxed-daemons, "wb-proxyd with the Keychain and the Secure Enclave (I61)") measured the wb-proxyd profile. makes the change.
Spike code
Section titled “Spike code”Throwaway code on branch spike/x23-sandboxed-daemons, commit
546489c,
tag spike-x23-sandboxed-daemons-i61: the helper (i61/helper), its
build and run scripts, the minimizing script, the profiles, and the
recorded output (i61/results).
Not covered
Section titled “Not covered”- A profile for
wb-vmd(I64I64 (closed): X25-vmd-sandbox: Self-sandboxed wb-vmdFound while answering #34 (X23-sandboxed-daemons).). - Reading the user’s repository. S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem. has
wb-hostdrungit upload-packagainst the user’s repository, or fetch from it into an export repository (I41I41 (closed): S08-workspace-and-git: which git data reaches the guest, and host git as a parserS08-workspace-and-git says how bytes move, but not which data the guest may get or how much the host trusts its own git when it parses guest data:). Thewb-hostdprofile can’t read it, and a profile can’t be widened after start. I67I67 (closed): wb-hostd can't read the user's repository under its sandbox profile (S08 upload-pack)Found in the review of #65 (X23-sandboxed-daemons result). has the options:wbrunsupload-packand tunnels it, or a spec change. - How
wb-proxydties a stream fromwb-netdto a VM and project (I68I68 (closed): wb-proxyd must bind stream identity to the connection, not to wb-netd's tagsFound in the security review of #65 (X23-sandboxed-daemons result).). - The launcher as specified in condition 3, and the
wb-gitshim. The spike’s launcher was looser. - App Sandbox through entitlements, as an alternative mechanism.
- Running the amd64 build. It compiles, and this host has no Rosetta.
Status: Answered: yes with conditions. wb-proxyd Keychain part answered 2026-10-15 (I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04.): yes