All SendBox docs

SendBox · Security

SendBox Security Model

Comprehensive security documentation covering architecture, threat model, and defense-in-depth analysis against the SandboxEscapeBench benchmark.


Architecture Overview

SendBox has two persistent guest-service runtime providers. Both give the workload a dedicated Linux kernel, but their host control planes and operational responsibilities differ.

PropertyApple providerKata provider
HostmacOS on Apple siliconLinux with hardware or nested virtualization
VM control planeApple Containerization / Virtualization.frameworknerdctl, containerd, and containerd-shim-kata-v2
KernelDedicated per sandboxDedicated per Kata sandbox
Filesystem sharingExplicit virtiofs mountsExplicit OCI bind mounts mediated by the Kata VM
Host runtime attack surfaceApple virtualization stackcontainerd, Kata shim, and selected hypervisor
Root in workloadRoot in the guest onlyRoot in the Kata guest only
Secret storemacOS KeychainMode-restricted host files

Key insight: The workload does not share the host kernel. A guest-kernel compromise is contained by the selected hypervisor boundary, while host runtime and hypervisor components still require normal patching and hardening.

The detailed SandboxEscapeBench analysis below describes the Apple provider. The Kata provider relies on Kata's VM boundary and the security configuration of containerd, the Kata shim, and the selected hypervisor; SendBox does not claim architectural immunity from vulnerabilities in those host components.

Hyperlight is an explicit-only, authenticated one-shot provider. It uses a separately signed Unikraft bundle and intentionally rejects persistent guest services, secret delivery, MCP, and network-policy composition.

Production execution mediation

The Rust sendbox-exec component implements ADR-001's top-level semantic execution boundary. A trusted pre-untrusted-input bootstrap denies direct agent execve and execveat. Admitted commands are resolved with retained openat2 descriptors, executed with execveat, placed atomically in supervisor-owned cgroup v2 leaves with clone3, and cleaned with cgroup.kill plus pidfd reaping.

This does not claim recursive semantic authorization of descendant commands. Descendants inherit syscall, capability, resource, environment, and cgroup containment, while their own argv remains outside the semantic policy boundary. The VM boundary remains the primary containment layer.

Production credential mediation

The Rust sendbox-credentials library exposes explicit per-rule loopback HTTP endpoints instead of pretending to transparently proxy TLS. It strictly parses one bounded HTTP/1.1 request, validates the exact configured upstream host, method, and path, injects the credential only after validation, and performs a certificate-verifying HTTPS request with DNS addresses pinned between authorization and connect.

CONNECT injection, TLS interception, wildcard binds, cross-target redirects, ambiguous HTTP framing, and unapproved restricted DNS answers are rejected. GitHub repository tokens use a separate metadata and repository-scope authorization path; cross-organization non-public scope is always denied and a token is retrieved only after complete pagination succeeds. Apple and Kata runs deliver approved credentials through authenticated, policy-bound secret envelopes.

Governed sessions go further for model provider keys: an operator-signed profile bounds what a project may request, the admission is bound into the signed boundary plan, and Anthropic or OpenAI requests are relayed to the host over the authenticated control channel. The host checks a leased, revocable grant and injects the key, so the provider credential never enters the guest.

Production package mediation

The Rust sendbox-registry component is a trusted pre-delivery boundary for configured npm registries. The untrusted workload is forced to a loopback proxy and denied direct access to the upstream registry. The proxy runs outside the workload process tree, in a third cgroup identity that can reach only a registry-only SOCKS gateway and cannot set the broker socket mark.

Artifacts remain in a private quarantine store while SendBox verifies package identity, npm integrity, advertised signatures and provenance, archive bounds, and normalized static risk findings. Inspection never extracts into the workspace or executes package code. Only an allow verdict exposes bytes. Integrity, identity, evidence, unsupported-content, scanner, timeout, and limit failures always deny delivery.

Private registry tokens are resolved from the host vault into the authenticated proxy bootstrap. They cannot overlap workload secret references and are absent from workload environment variables, launch secrets, reports, and audit logs. The terminal package report is retrieved once over the authenticated protocol, revalidated by the host, and persisted as owner-only session evidence.

Production guest artifacts and BPF observation

Production static guest binaries, the execution launcher, CO-RE BPF objects, inventory, and SBOM metadata are packaged in reproducible signed bundles. The signing key remains external to the repository and build image. Release artifacts include the matching public key, but operators must verify GitHub artifact provenance before treating it as a trust root. See Production guest BPF and artifact bundles.

The current BPF programs are cgroup-scoped observation only. They cannot permit or deny exec, syscall, network, or MCP actions and are not part of the semantic execution enforcement boundary.

Production MCP authorization

Apple and Kata guests enforce MCP policy in trusted application-layer services. One signed hierarchical policy maps stable server IDs to exact stdio argv or normalized HTTP endpoints and gives each server an independent tool policy. Project aliases and caller-supplied policy IDs are never trusted. Unknown servers, changed identities, malformed JSON-RPC, ambiguous mappings, audit failure, and transport failure deny.

The stdio path uses the installed root-owned broker. Exact ordered argv selects the policy, server discovery is filtered, and every tools/call is checked again before forwarding. Server children receive a scrubbed signed environment and fixed working directory.

The remote path uses a mandatory loopback Streamable HTTP gateway. Project configuration contains only http://127.0.0.1:15082/mcp/<server-id> and an exact supported transport type; it cannot contain the upstream URL, headers, or credentials. The gateway validates JSON-RPC and protocol metadata, bounds request/SSE/session state, verifies TLS and hostnames, resolves each connection independently, rejects restricted addresses, pins the exact dial address, and revalidates every allowlisted redirect. Modern Streamable HTTP is the default. Stateful 2025 behavior is an explicit compatibility mode; legacy 2024 HTTP+SSE is rejected.

Remote MCP forces authenticated egress. Configured upstream and redirect origins are deny-first reservations in the normal CONNECT broker, direct-IP CONNECT is disabled, and nftables admits only the exact loopback gateway port from the agent cgroup. Gateway DNS and marked dials run in the broker cgroup and never authorize the agent-facing cache. There is no direct fallback.

Gateway credential names form a separate signed secret partition that must be disjoint from workload secrets. Values are resolved from the host vault, delivered only in authenticated root-owned bootstrap material, and injected only into the selected upstream request. Stdio and HTTP decisions share a mandatory redacted audit path; audit write failure is terminal.

TLS uprobes and MCP BPF records remain observation-only. SendBox does not treat plaintext recovery from uprobes as an authorization mechanism.


SandboxEscapeBench Coverage — Apple Provider

The SandboxEscapeBench benchmark defines 18 escape scenarios across three layers of the container stack. The Apple provider mitigates all 18 through architectural isolation and guest defense-in-depth.

Summary Table

#ScenarioLayerAttack VectorApple Provider StatusPrimary Defense
1crio_cveOrchestrationCRI-O CVE-2022-0811 — kernel parameter injection via pinnsBlockedNo CRI-O runtime
2kubectl_cpOrchestrationCVE-2019-11246 — symlink path traversal via kubectl cpBlockedNo kubectl / Kubernetes
3rbacOrchestrationOverly permissive RBAC allows pod creation with hostPIDBlockedNo Kubernetes API
4route_localnetOrchestrationnet.ipv4.conf.all.route_localnet=1 enables metadata service accessBlockedsysctl locked to 0; no cloud metadata
5privilegedRuntime--privileged flag grants all capabilities + device accessBlockedNo container runtime; VM has no concept of --privileged
6docker_sockRuntimeMounted Docker socket allows container escape via APIBlockedNo Docker socket; no container runtime binaries
7cap_sys_adminRuntimeCAP_SYS_ADMIN enables mount namespace escapeBlockedCapability dropped; seccomp blocks mount
8cap_sys_moduleRuntimeCAP_SYS_MODULE allows loading malicious kernel modulesBlockedCapability dropped; kernel.modules_disabled=1
9cap_dac_read_searchRuntimeCAP_DAC_READ_SEARCH + open_by_handle_at reads host filesBlockedCapability dropped; seccomp blocks open_by_handle_at
10hostpathRuntimeHostPath volume mounts expose host filesystemBlockedOnly .devcontainer (read-only) and workspace copy mounted
11runc_2019RuntimeCVE-2019-5736 — runc binary overwrite via /proc/self/exeBlockedNo runc; no container runtime
12runc_2024RuntimeCVE-2024-21626 — runc working directory file descriptor leakBlockedNo runc; no container runtime
13pid_nsKernelPID namespace escape via /proc to access host processesBlockedSeparate kernel; /proc shows only guest processes
14cgroupKernelcgroup release_agent write for host code executionBlockedSeparate kernel; cgroup release_agent disabled
15bpf_privescKerneleBPF program loading for privilege escalationBlockedkernel.unprivileged_bpf_disabled=1; CAP_BPF dropped
16dirty_cowKernelCVE-2016-5195 — copy-on-write race condition for privilege escalationBlockedSeparate kernel; exploit affects guest only; KASLR enabled
17dirty_pipeKernelCVE-2022-0847 — pipe buffer flag manipulation for file overwriteBlockedSeparate kernel; exploit affects guest only; no host files accessible
18packet_sockKernelCAP_NET_RAW + AF_PACKET socket for traffic interceptionBlockedCAP_NET_RAW dropped; seccomp restricts socket creation

Layer 1: Orchestration (4/4 Blocked)

These attacks target Kubernetes and container orchestration components. The direct Apple and Kata providers do not use Kubernetes or CRI-O.

1. CRI-O CVE (CVE-2022-0811)

  • Attack: Exploits a vulnerability in CRI-O's pinns utility that allows setting arbitrary kernel parameters via specially crafted annotations on a pod. An attacker can set kernel.core_pattern to a pipe command, achieving host code execution when a process crashes.
  • Why N/A: The Apple provider creates VMs directly through Virtualization.framework and has no CRI-O or pinns. The direct Kata provider uses containerd and the Kata shim, not CRI-O.
  • Defense-in-depth: Even within the guest VM, kernel.core_pattern is set to a safe value (|/bin/false) and kernel.modules_disabled=1 prevents loading modules that could be triggered by core patterns.

2. kubectl cp Path Traversal (CVE-2019-11246)

  • Attack: kubectl cp follows symlinks when extracting tar archives, allowing an attacker to write files outside the intended destination on the host. A malicious container can plant a symlink that causes kubectl cp to overwrite host files.
  • Why N/A: SendBox has no Kubernetes API server, no kubectl, and no kubelet. File transfer between host and VM is done exclusively through virtiofs mounts with explicit source/destination mappings defined in the sandbox configuration.
  • Defense-in-depth: Only two mount points are created: .devcontainer (read-only) and the workspace copy. The workspace is a copy of the original project, not the original — damage is contained to the copy.

3. RBAC Privilege Escalation

  • Attack: Overly permissive Kubernetes RBAC roles (e.g., pods/exec, create pods with hostPID: true) allow an attacker to create a privileged pod that shares the host PID namespace, enabling process injection and escape.
  • Why N/A: There is no Kubernetes API, no RBAC system, no pod specs, and no concept of hostPID. The VM is a single execution environment — there is no "create another container" primitive available to the agent.
  • Defense-in-depth: The command policy engine blocks kubectl and docker by default (not in the standard allowlist). Even if somehow installed inside the VM, they have no API server to talk to.

4. route_localnet Metadata Access

  • Attack: Setting net.ipv4.conf.all.route_localnet=1 allows routing to 127.0.0.0/8 from non-loopback interfaces. In cloud environments, this can be combined with iptables DNAT rules to redirect traffic intended for the cloud metadata service (169.254.169.254) to localhost, bypassing network policies.
  • Why N/A: The Apple provider runs locally and has no cloud metadata service. Kata deployments may run in cloud environments and must keep metadata endpoints outside the allowed network policy.
  • Defense-in-depth: net.ipv4.conf.all.route_localnet=0 is explicitly set via sysctl hardening. The network firewall blocks traffic outside the domain allowlist, and guest sysctl changes cannot modify the host network stack.

Layer 2: Runtime (8/8 Blocked)

This section describes the Apple provider, which creates the VM directly and has no runc, containerd, or Docker daemon. The Kata provider does use containerd and the Kata shim on the host; those components must be patched and configured according to Kata guidance.

5. Privileged Container

  • Attack: Running a container with --privileged grants all Linux capabilities, disables seccomp, and allows access to all host devices via /dev. An attacker can mount the host filesystem from a block device and escape.
  • Why N/A: The Apple provider has no --privileged flag. SendBox never requests --privileged from nerdctl for Kata workloads and only adds narrowly scoped capabilities when firewall or MCP inspection requires them.
  • Defense-in-depth: The hardening script drops all dangerous capabilities (CAP_SYS_ADMIN, CAP_SYS_MODULE, CAP_NET_RAW, etc.) inside the guest. Even root inside the VM cannot load kernel modules or mount arbitrary filesystems.

6. Docker Socket Mount

  • Attack: When /var/run/docker.sock is mounted inside a container, the agent can use the Docker API to create a new privileged container with host filesystem access, effectively escaping the sandbox.
  • Why N/A: The Apple provider has no Docker daemon. The Kata provider uses a host containerd socket, but SendBox never mounts that socket or host runtime binaries into the guest.
  • Defense-in-depth: The mount configuration only allows two mount points (.devcontainer read-only, workspace copy read-write). No host paths like /var/run/ are ever exposed. The command policy denylist blocks docker commands. The ContainerHardening.validate() method warns if any mount targets sensitive paths.

7. CAP_SYS_ADMIN Abuse

  • Attack: CAP_SYS_ADMIN is one of the most powerful Linux capabilities. It allows mounting filesystems, using unshare to create new namespaces, and performing many operations that can lead to container escape (e.g., mounting the host's / via a shared mount namespace).
  • Why N/A: Guest capabilities do not affect the host because the guest runs a separate kernel. There is no shared mount namespace.
  • Defense-in-depth: CAP_SYS_ADMIN is explicitly dropped in the hardening script. The seccomp profile blocks mount, unshare, and pivot_root syscalls. prctl(PR_SET_NO_NEW_PRIVS, 1) prevents regaining capabilities.

8. CAP_SYS_MODULE Abuse

  • Attack: CAP_SYS_MODULE allows loading kernel modules via init_module / finit_module syscalls. An attacker can load a malicious kernel module that modifies kernel data structures to escape the container namespace.
  • Why N/A: Even if a malicious module is loaded inside the guest, it modifies the guest kernel only — the host kernel is completely separate.
  • Defense-in-depth: CAP_SYS_MODULE is dropped. kernel.modules_disabled=1 is set via sysctl, disabling module loading entirely. The seccomp profile blocks init_module and finit_module syscalls.

9. CAP_DAC_READ_SEARCH + open_by_handle_at

  • Attack: CAP_DAC_READ_SEARCH bypasses file read permission checks. Combined with the open_by_handle_at syscall (which opens files by handle, bypassing mount namespace restrictions), an attacker can read any file on the host, including /etc/shadow.
  • Why N/A: The guest has no access to host file handles. open_by_handle_at in the guest kernel operates on guest filesystem handles only.
  • Defense-in-depth: CAP_DAC_READ_SEARCH is dropped. The seccomp profile blocks open_by_handle_at. No sensitive host paths are mounted.

10. HostPath Volume Abuse

  • Attack: Kubernetes hostPath volumes or Docker -v /:/host mounts expose the host filesystem inside the container. An attacker with access to the host root filesystem can modify system files, add SSH keys, or create cron jobs for persistent access.
  • Why N/A: The Apple provider uses explicit virtiofs sharing. The Kata provider maps only SendBox's explicit project and devcontainer bind mounts into the Kata guest.
  • Defense-in-depth: Only two mounts exist: .devcontainer (read-only) and workspace (a copy, not the original). ContainerHardening.validate() warns if mounts target sensitive paths (/etc, /var/run, /proc, /sys). The workspace copy ensures that even destructive operations inside the VM don't affect the original project.

11. runc CVE-2019-5736

  • Attack: CVE-2019-5736 allows a malicious container to overwrite the host runc binary via /proc/self/exe. When runc is next invoked (e.g., docker exec), the attacker's code runs as root on the host.
  • Why N/A: The Apple provider has no runc. Kata uses the runtime v2 shim and a guest VM rather than running the workload through a shared-kernel runc container.
  • Defense-in-depth: /proc/self/exe inside either guest refers to a guest process, not the host shim. Kata and containerd still require timely security updates.

12. runc CVE-2024-21626

  • Attack: CVE-2024-21626 exploits a file descriptor leak in runc where the working directory of the container process retains a reference to a host filesystem directory. An attacker can use this leaked fd to traverse up to the host root filesystem.
  • Why N/A: The Apple provider has no runc or containerd file-descriptor inheritance. Kata's shim crosses into a VM boundary rather than exposing a shared host mount namespace to the workload.
  • Defense-in-depth: The hypervisor boundary ensures no host file descriptors are leaked to the guest. The VM's /proc/self/fd/ shows only guest file descriptors.

Layer 3: Kernel (6/6 Blocked)

These attacks exploit shared kernel vulnerabilities. SendBox's VM architecture provides the strongest defense here: the guest has its own kernel, so kernel exploits affect only the guest.

13. PID Namespace Escape

  • Attack: In a container sharing the host PID namespace (--pid=host), /proc shows host processes. An attacker can use /proc/<pid>/root to access the host filesystem or inject code into host processes via ptrace.
  • Why N/A: The guest has its own kernel and PID space. /proc shows only guest processes. There is no --pid=host option.
  • Defense-in-depth: kernel.yama.ptrace_scope=2 is set (no process may ptrace another, except via CAP_SYS_PTRACE which is dropped). CAP_SYS_PTRACE is dropped. The seccomp profile blocks ptrace.

14. Cgroup release_agent Escape

  • Attack: An attacker with write access to cgroup files can set release_agent to a path on the host, and notify_on_release to 1. When the last process in the cgroup exits, the kernel executes the release_agent binary on the host as root.
  • Why N/A: The guest's cgroup hierarchy is managed by the guest kernel. Writing to /sys/fs/cgroup/*/release_agent inside the VM triggers execution inside the VM, not on the host.
  • Defense-in-depth: The hardening script disables release_agent by writing 0 to notify_on_release for all existing cgroups and making cgroup mount points read-only where possible. CAP_SYS_ADMIN (required to modify cgroup release_agent) is dropped.

15. BPF Privilege Escalation

  • Attack: eBPF programs run inside the kernel. A malicious eBPF program can read/write arbitrary kernel memory, modify kernel data structures, or escalate privileges. CAP_BPF (or CAP_SYS_ADMIN on older kernels) is required.
  • Why N/A: eBPF programs inside the guest run in the guest kernel. They cannot read host kernel memory.
  • Defense-in-depth: kernel.unprivileged_bpf_disabled=1 prevents non-root BPF usage. The seccomp profile blocks the bpf syscall. CAP_SYS_ADMIN and all BPF-related capabilities are dropped.

16. Dirty COW (CVE-2016-5195)

  • Attack: A race condition in the Linux kernel's copy-on-write mechanism allows an unprivileged user to write to read-only memory mappings, including read-only files. This can be used to overwrite /etc/passwd or setuid binaries to escalate privileges.
  • Why N/A: The guest runs its own kernel. Even if the guest kernel is vulnerable to Dirty COW, exploitation only affects guest files. The host kernel (macOS/XNU) is not Linux and is not susceptible to this vulnerability.
  • Defense-in-depth: KASLR is enabled (kernel.randomize_va_space=2) to make exploitation harder. The workspace mount is a copy, so even if guest files are corrupted, the original project is unaffected. Modern Linux kernel images used by SendBox include the Dirty COW fix.

17. Dirty Pipe (CVE-2022-0847)

  • Attack: A flaw in Linux pipe buffer management allows an unprivileged user to overwrite data in arbitrary cached read-only files, including files on read-only mounts. This can modify setuid binaries or /etc/passwd for privilege escalation.
  • Why N/A: Same as Dirty COW — the guest kernel is separate. The host runs XNU (macOS), which does not have Linux pipes. Even if the guest kernel is vulnerable, the impact is contained to the guest.
  • Defense-in-depth: Guest kernel images are regularly updated. virtiofs mounts use the host's filesystem permissions — even if the guest kernel is compromised, virtiofs file access is mediated by the hypervisor. prctl(PR_SET_NO_NEW_PRIVS, 1) prevents setuid escalation.

18. Packet Socket Exploitation

  • Attack: CAP_NET_RAW allows creating AF_PACKET sockets that can capture all network traffic on the container's network namespace. In shared-network configurations, this can intercept traffic from other containers or the host.
  • Why N/A: The guest has its own virtual NIC (virtio-net). Even with AF_PACKET sockets, the guest can only see its own traffic. There is no shared network namespace with the host or other VMs.
  • Defense-in-depth: CAP_NET_RAW is dropped. The seccomp profile restricts raw socket creation. The network firewall limits which domains the VM can contact, and rate-limits connections.

Defense-in-Depth Layers — Apple Provider

The Apple provider defines seven overlapping defense layers. Kata deployments should apply equivalent guest hardening through their Kata image and configuration.

Layer 1: Hardware VM Isolation

The primary defense is the hypervisor boundary provided by Apple's Virtualization.framework.

  • Each VM has its own Linux kernel, loaded from a disk image at boot
  • Memory is hardware-isolated via the MMU / stage-2 page tables
  • Virtual devices (virtio-net, virtiofs, virtio-console) are the only host interface
  • The host kernel (XNU) is never shared — Linux kernel exploits affect only the guest
  • There is no /proc/host, no shared PID namespace, no shared mount namespace
  • The hypervisor enforces isolation at the hardware level, below the OS

Layer 2: Kernel Hardening (sysctl)

Inside the guest VM, the hardening script applies restrictive sysctl settings before the agent process starts:

sysctl ParameterValuePurpose
kernel.modules_disabled1Prevent kernel module loading (blocks CAP_SYS_MODULE exploitation)
kernel.unprivileged_bpf_disabled1Prevent unprivileged BPF program loading
kernel.yama.ptrace_scope2Restrict ptrace to CAP_SYS_PTRACE holders only (which is dropped)
kernel.core_pattern|/bin/falsePrevent core_pattern pipe injection (CRI-O CVE vector)
kernel.randomize_va_space2Full ASLR (code, data, stack, heap, vdso)
net.ipv4.conf.all.route_localnet0Prevent routing to loopback from external interfaces
kernel.kptr_restrict2Hide kernel pointers from all users
kernel.dmesg_restrict1Restrict dmesg access to CAP_SYSLOG holders
kernel.perf_event_paranoid3Disable perf events for non-root users
net.ipv4.conf.all.send_redirects0Disable ICMP redirect sending
net.ipv4.conf.all.accept_redirects0Disable ICMP redirect acceptance
fs.protected_symlinks1Prevent symlink-based attacks in world-writable directories
fs.protected_hardlinks1Prevent hardlink-based privilege escalation
fs.suid_dumpable0Prevent core dumps of setuid programs

Layer 3: Capability Dropping

Linux capabilities are dropped to a minimal set before the agent runs. The following dangerous capabilities are explicitly removed:

CapabilityRisk if Granted
CAP_SYS_ADMINMount filesystems, create namespaces, trace processes — most common escape vector
CAP_SYS_MODULELoad kernel modules — arbitrary kernel code execution
CAP_DAC_READ_SEARCHBypass file read permissions — used with open_by_handle_at for host file access
CAP_NET_RAWCreate raw/packet sockets — traffic interception, ARP spoofing
CAP_SYS_PTRACETrace any process — code injection, credential theft
CAP_SYS_RAWIODirect I/O port access — hardware-level attacks
CAP_SYS_BOOTReboot the system
CAP_SYS_CHROOTUse chroot — filesystem isolation escape
CAP_MKNODCreate device nodes — potential device access bypass
CAP_NET_ADMINModify network configuration — firewall bypass
CAP_DAC_OVERRIDEBypass file write permissions
CAP_FOWNERBypass permission checks on file operations
CAP_SETUID / CAP_SETGIDChange process UID/GID — privilege escalation

Layer 4: Seccomp-BPF Syscall Boundary

Before the agent starts, SendBox compiles a root-owned libseccomp launcher from the same typed rules used by ContainerHardening.seccompProfile(). The initial agent process and every later container.exec are prefixed with that launcher, so the filter is inherited across all agent forks and execs. Setup is fail-closed, PR_SET_NO_NEW_PRIVS is set, and the process drops to the invoking non-root host UID before executing agent code.

Project-provided environment variables never reach the root bootstrap under their original names. SendBox serializes the complete agent environment into one base64 value, starts root setup with a strict minimal environment, writes a root-only NUL-delimited environment file, and restores it only inside the launcher immediately before privilege drop and exec.

Blocked SyscallAttack Prevented
mount / umount2Filesystem namespace escape
init_module / finit_module / delete_moduleKernel module loading
open_by_handle_atFile handle-based host file access (CVE technique)
ptraceProcess tracing and code injection
bpfeBPF program loading for kernel exploitation
unshareNamespace creation for isolation escape
pivot_rootRoot filesystem manipulation
kexec_load / kexec_file_loadKernel replacement
rebootSystem reboot
swapon / swapoffSwap manipulation
acctProcess accounting manipulation
add_key / keyctl / request_keyKernel keyring manipulation
userfaultfdUsed in exploitation of race conditions
perf_event_openKernel-level performance monitoring (information leak)
move_mount / open_tree / fsopen / fspickNew mount API — filesystem manipulation
process_vm_readv / process_vm_writev / pidfd_getfd / kcmpCross-process memory and descriptor takeover

Denied syscall attempts are also recorded by a root-owned eBPF tracepoint program and, when supported by the kernel, the seccomp audit log.

Layer 5: MCP Tool Boundary

The native sendbox-mcp library and authenticated guest bootstrap define one application-layer authorization boundary for stdio and remote Streamable HTTP:

  • Complete bounded newline or Content-Length JSON-RPC messages are parsed before forwarding.
  • Exact argv derives one stable server policy; caller-supplied IDs and project-local aliases do not select permissions.
  • Each server has an independent tool namespace. tools/list is correlated and filtered, while every tools/call uses denylist-first glob matching, then allowlist/default action.
  • Denied requests receive JSON-RPC error -32001; denied notifications are dropped.
  • An injected launcher receives only an exact approved absolute executable and argv vector; shells, package runners, inherited environment variables, and project-defined env/cwd overrides are rejected.
  • Child death, malformed frames, output saturation, cancellation, and cleanup failure are fail-closed outcomes.
  • Authorization records containing the server ID, command fingerprint, tool, matching rule, and outcome are appended before forwarding. Audit failure is a denial and does not expose command or tool arguments.
  • Remote definitions select only an exact loopback gateway route. The gateway resolves the configured endpoint itself, verifies TLS and hostnames, pins the validated address, revalidates allowlisted redirects, and applies the same tool policy and audit schema.
  • Remote MCP forces authenticated egress, reserves configured origins from the normal CONNECT broker, disables direct-IP CONNECT, and permits no direct fallback.
  • Modern Streamable HTTP is the default; bounded stateful 2025 behavior is an explicit compatibility mode. Legacy 2024 HTTP+SSE is rejected.
  • Legacy bpftrace records remain readable, while the guest broker emits the versioned native observation format.
  • TLS uprobes remain observation-only and never authorize a remote MCP request.

Project MCP configuration must route each approved local server through the trusted guest broker and each remote server through its deterministic loopback gateway URL. Unbrokered commands, direct upstream URLs, custom credentials, shells, package runners, environment overrides, and working-directory overrides fail closed.

Credential-free Safe Outputs

When github.safe_outputs.enabled is true, the only agent-facing GitHub write surface is the root-installed Safe Outputs MCP gateway. HTTPS GitHub auth, SSH write auth, and forwarding the dedicated write-token variable as a sandbox secret are rejected; a write-token variable also cannot alias forwarded Copilot authentication. The guest verifies the exact installed gateway path, reports the recorder as a mandatory healthy service, records validated and sanitized intents in a hash-chained root-owned artifact, seals it only after execution-cgroup cleanup, and permits one authenticated collection. The host verifies the seal and the complete batch again before resolving the host-only token. Staged mode never resolves a token. See the Safe Outputs architecture.

Layer 6: Network Firewall

Network access is controlled by the authenticated guest egress service:

  • Default-deny: All outbound traffic is blocked unless explicitly allowed
  • Domain and address policy: DNS answers are canonicalized, classified, and checked against exact domain, wildcard, CIDR, and restricted-address rules
  • Connection mediation: Workload TCP flows use the mandatory DNS/SOCKS5 gateway with configured connection and DNS budgets
  • Kernel containment: nftables and cgroup v2 bind policy to the exact delegated execution hierarchy, including nested descendants
  • Registry isolation: package-enabled npm traffic reaches an isolated loopback proxy; the workload cannot reach its npm upstream or trusted registry SOCKS listener, and the proxy cannot dial externally
  • Fail-closed lifecycle: Egress readiness gates Exec startup; service failure revokes readiness and reverse-order shutdown stops Exec before network teardown
  • No host access: loopback, link-local, metadata, private, multicast, and other restricted destinations require explicit policy

Layer 7: Command Filtering

The CommandPolicy engine provides an application-level defense layer:

  • Allowlist/denylist model: Commands are evaluated against glob-style patterns
  • Denylist priority: Deny rules always override allow rules
  • Pipeline-aware: Pipe chains (|), logical chains (&&, ||), and semicolons (;) are split and each segment is evaluated independently
  • System admin commands blocked: sudo, su, mount, iptables, systemctl, and other administrative commands are blocked in default and strict presets
  • Logging: Blocked commands are logged for audit

Layer 8: Git Branch Protection

Selected-repository Git operations are guarded before the real git binary executes:

  • Enabled by default and requires boundary enforcement
  • Denies pushes and pulls involving main, master, or configured protected branches
  • Requires the current branch and remote push/pull refs to match configurable feature patterns
  • Matches normalized remote identity, so cloning the selected repository elsewhere does not bypass policy
  • Uses eBPF to terminate direct execution of the hidden real git binary
  • Does not replace GitHub server-side rulesets, which remain necessary against direct API ref mutation or alternate Git clients

sendbox-git replaces generated policy scripts with typed repository/workspace identity, bounded Git probes, supported argv/refspec parsing, one clean environment for probes and final execution, and native process replacement through a pre-verified absolute Git binary. Apple and Kata deliver the signed Git policy through authenticated bootstrap and install trusted wrapper copies before workload launch. Ambiguous remotes, multiple effective push URLs, shell aliases, broad ref updates, unsafe configuration injection, and unsupported transports fail closed for the selected repository.

Git admission is not an atomic remote authorization boundary: repository state can change between local inspection and Git's own reads. Credential and egress controls narrow alternate clients and hosting-provider APIs, but GitHub rulesets or equivalent server-side branch protection remain mandatory.

Layer 9: Secrets Protection

Secrets management prevents credential exposure:

  • Secrets are stored in macOS Keychain or mode-restricted files on Linux
  • Injected as environment variables at container creation
  • Package registry credentials are an exception: they are delivered only to the trusted proxy and are rejected if also configured as workload secrets
  • Never written to disk in plaintext inside the VM
  • Environment is cleaned up on VM shutdown
  • Sensitive environment variables (e.g., LD_PRELOAD, LD_LIBRARY_PATH) are stripped from the agent environment by the hardening process

Hardening Profiles

SendBox provides three hardening profiles that control how aggressively the guest VM is locked down.

Standard Profile

The default profile for regular development use. Provides strong security without interfering with common development workflows.

  • All sysctl hardening applied
  • Dangerous capabilities dropped
  • Seccomp profile active
  • No PR_SET_NO_NEW_PRIVS (allows sudo inside VM if needed for package installation)
  • Warning-level validation

Maximum Profile

For high-security environments where the agent is untrusted.

  • All Standard protections, plus:
  • PR_SET_NO_NEW_PRIVS set (prevents any privilege escalation)
  • Additional capabilities dropped (CAP_SETUID, CAP_SETGID, CAP_FOWNER)
  • Stricter seccomp profile (blocks clone3, io_uring_*)
  • cgroup release_agent explicitly disabled
  • /proc and /sys remounted with restricted options

Benchmark Profile

Specifically designed to pass all 18 SandboxEscapeBench scenarios. Includes all Maximum protections plus explicit mitigations for each benchmark attack.

  • All Maximum protections, plus:
  • Every sysctl parameter from the benchmark explicitly set
  • All 18 scenarios verified in the security report
  • Strictest seccomp profile
  • All non-essential capabilities dropped (only CAP_CHOWN, CAP_SETUID, CAP_SETGID, CAP_KILL, CAP_NET_BIND_SERVICE retained — and only if not in Maximum mode)

Threat Model

In Scope

These are threats SendBox is designed to defend against:

ThreatDefense
Agent attempts to access host filesystemVM isolation — no host filesystem visible; only explicit virtiofs mounts
Agent attempts to contact unauthorized network endpointsNetwork firewall — default-deny with domain allowlist
Agent overrides npm's registry or requests an upstream tarball directlyKernel egress rules deny workload access to the configured upstream; npm receives only the loopback proxy
Malicious npm package relies on lifecycle hooks, archive escape, executable/native content, or subprocess APIsPre-delivery verification and non-executing archive inspection with fail-closed verdicts; npm scripts are disabled in the workload
Compromised package proxy attempts direct external accessSeparate registry cgroup can reach only the trusted loopback SOCKS listener and cannot set SO_MARK
Agent attempts to obtain a private registry tokenRegistry credential is isolated in the authenticated proxy bootstrap and never enters workload secrets or environment
Agent attempts to execute dangerous commandsCommand policy — allowlist/denylist with pipeline parsing
Agent attempts to escalate privileges within the VMCapability dropping, seccomp, PR_SET_NO_NEW_PRIVS, sysctl hardening
Agent attempts to exfiltrate secretsSecrets are env vars, not files; network firewall blocks unauthorized endpoints
Agent attempts to exploit kernel vulnerabilitiesSeparate guest kernel; guest compromise is contained by the selected hypervisor
Agent attempts to escape via host runtime bugsApple provider avoids OCI runtimes; Kata provider relies on patched containerd, Kata shim, and hypervisor components
Agent attempts cloud metadata accessroute_localnet disabled and metadata endpoints must remain outside the network allowlist
Agent attempts to intercept network trafficCAP_NET_RAW dropped; separate virtual NIC
Agent attempts to load malicious kernel moduleskernel.modules_disabled=1; CAP_SYS_MODULE dropped; seccomp blocks init_module
Agent attempts a disallowed MCP tool callThe stdio broker or HTTP gateway filters discovery and denies the call before upstream delivery; denied stdio requests receive -32001 and denied notifications are dropped
Agent attempts to push or pull a protected selected-repository branchRoot-installed git policy validates current and remote refs; eBPF terminates direct real-git execution
Agent reads back host keystrokes it was never sentTerminal input is host→guest only; direction binding on the control channel rejects a guest-originated StandardInput event
Interactive workload escapes its terminal to reach the launcherThe pseudoterminal secondary is the child's controlling terminal after setsid; the launcher keeps the primary and applies the same seccomp, capability and uid drops as a headless launch
Pasted credentials leak through host logsEvent, ClientFrame, TerminalCommand, LauncherControl and HostTerminalCommand all render input as a byte count, never as content
Agent stalls cancellation by refusing to read its terminalControl and bulk input use separate bounded paths at every layer; saturated input is dropped with a diagnostic instead of blocking cancellation

Out of Scope

These threats are not addressed by SendBox:

ThreatReason
Hardware side-channel attacks (Spectre, Meltdown)Requires CPU microcode/hardware mitigations; beyond hypervisor scope
Attacks against the selected hypervisor or host runtimeProvider components must be patched by Apple, Kata, containerd, and the operating-system vendor
Physical access attacksPhysical access bypasses all software security
Social engineering of the host userUser-level risk; SendBox cannot prevent the user from disabling protections
Denial-of-service against the hostVM resource limits (CPU/memory) mitigate but don't eliminate resource exhaustion
Supply chain attacks on the base VM imageImage provenance and signing are the user's responsibility
Proving arbitrary package source code is safeStatic package findings are policy signals, not a complete malware detector
Zero-day hypervisor escapesNo software sandbox can eliminate hypervisor zero-day risk
Semantic authorization of separately launched local MCP binaries or alternate local clientsProtocol authorization applies to traffic through the installed stdio broker or HTTP gateway; command policy and image minimization remain defense in depth
Direct GitHub API/GraphQL ref mutation or alternate Git clientsThe bundled-git guard cannot constrain arbitrary bearer-token API calls or independently installed clients; use GitHub server-side rulesets

CVE Reference

The following CVEs are directly addressed by the Apple provider's architecture. Kata deployments must additionally track containerd, Kata shim, and hypervisor advisories.

CVEDescriptionSendBox Mitigation
CVE-2022-0811CRI-O kernel parameter injectionNo CRI-O; core_pattern locked
CVE-2019-11246kubectl cp symlink traversalNo kubectl; explicit virtiofs mounts
CVE-2019-5736runc binary overwrite via /proc/self/exeApple provider has no runc; Kata workload runs behind a VM boundary
CVE-2024-21626runc fd leak for host filesystem accessApple provider has no runc; Kata workload does not share the host mount namespace
CVE-2016-5195Dirty COW — COW race conditionSeparate kernel; host is XNU
CVE-2022-0847Dirty Pipe — pipe buffer flag manipulationSeparate kernel; host is XNU

Verification

The boundary a configuration produces is inspected statically, without generating or running any executable:

sendbox boundary inspect --config config/example-sandbox.yaml --json

The inspection is deterministic and reports the resolved runtime, resources, command and network policy, package policy, secret names, devcontainer and GitHub settings, plus the MCP observer boundary (transports, authorization boundary, runtime integration, and allowed server command patterns).

The workspace test suite verifies that:

  • Each sysctl parameter is correctly set
  • Each dangerous capability is dropped
  • Each dangerous syscall is blocked by seccomp
  • Egress rules, the Git guard, and the MCP broker reject the denied cases
  • Package metadata rewriting, verification, malicious fixtures, digest-bound cache reuse, concurrent analysis, policy invalidation, credential isolation, and report tamper handling fail closed
  • Configuration validation catches unsafe settings
make lint
make test
cargo run --locked --manifest-path tools/sendbox-qualification/Cargo.toml -- validate