S13-03 - Layer 3: Per-Program Network Attribution (after X14-flow-attribution)
Purpose: How a Network Extension in the guest labels each flow with the program and user that opened it, and how rules match on the label.
Design
Section titled “Design”A Network Extension system extension in the guest
(NETransparentProxyProvider) sees every TCP and UDP flow, together
with the source process’s audit token.
The label
Section titled “The label”For each flow the extension reports a label to the host:
- Program. The executable path, signing identifier, team identifier, and code directory hash (cdhash). Apple Silicon runs only signed binaries, at least ad hoc signed. The cdhash identifies the file the way OpenShell’s SHA-256 does.
- User. The user ID of the process, from the same audit token. It names the project user, and so the project. Parallel sessions of one project run as the same user. So the label names a session only while its project has one session running.
wb-netd attaches the label to the stream it hands to wb-proxyd.
Rules on the label
Section titled “Rules on the label”Rules match on the label (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.):
- Matching. A rule’s
binariesentry matches the program that opened the connection. Ancestry isn’t available from a Network Extension, so helpers must be listed themselves, for examplegitandgit-remote-https. - Pinning. The first cdhash seen for a path is recorded. A later connection from the same path with another cdhash is denied and audited, as in OpenShell.
- Flows the extension doesn’t see arrive unlabeled, and only match rules with no program narrowing. Examples are flows of system daemons, and flows while the extension is killed or unloaded.
How labels reach the host
Section titled “How labels reach the host”Spike 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? decides how labels reach the host:
- a header on each flow; or
- a side channel over the host-guest socket, keyed by the connection’s addresses and ports.
Either way the host parses guest bytes, and the parser gets a fuzz target (C03-policy-and-approvalsC03-policy-and-approvals: Policy and ApprovalsThe test cases for network policy: loading it, combining the policies of the projects in one VM, modes per host, profile parts, learn mode, and the approval flow.).
Apple prerequisites
Section titled “Apple prerequisites”- A Developer ID with the Network Extension system extension entitlement.
- The extension is approved once, in the base image at build time (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.).
Production guests keep System Integrity Protection on. That is expected to stop guest root from replacing the extension, but not from killing it. 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? checks both. Development guests may turn it off.
Status: Draft