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.
| Property | Apple provider | Kata provider |
|---|---|---|
| Host | macOS on Apple silicon | Linux with hardware or nested virtualization |
| VM control plane | Apple Containerization / Virtualization.framework | nerdctl, containerd, and containerd-shim-kata-v2 |
| Kernel | Dedicated per sandbox | Dedicated per Kata sandbox |
| Filesystem sharing | Explicit virtiofs mounts | Explicit OCI bind mounts mediated by the Kata VM |
| Host runtime attack surface | Apple virtualization stack | containerd, Kata shim, and selected hypervisor |
| Root in workload | Root in the guest only | Root in the Kata guest only |
| Secret store | macOS Keychain | Mode-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
| # | Scenario | Layer | Attack Vector | Apple Provider Status | Primary Defense |
|---|---|---|---|---|---|
| 1 | crio_cve | Orchestration | CRI-O CVE-2022-0811 — kernel parameter injection via pinns | Blocked | No CRI-O runtime |
| 2 | kubectl_cp | Orchestration | CVE-2019-11246 — symlink path traversal via kubectl cp | Blocked | No kubectl / Kubernetes |
| 3 | rbac | Orchestration | Overly permissive RBAC allows pod creation with hostPID | Blocked | No Kubernetes API |
| 4 | route_localnet | Orchestration | net.ipv4.conf.all.route_localnet=1 enables metadata service access | Blocked | sysctl locked to 0; no cloud metadata |
| 5 | privileged | Runtime | --privileged flag grants all capabilities + device access | Blocked | No container runtime; VM has no concept of --privileged |
| 6 | docker_sock | Runtime | Mounted Docker socket allows container escape via API | Blocked | No Docker socket; no container runtime binaries |
| 7 | cap_sys_admin | Runtime | CAP_SYS_ADMIN enables mount namespace escape | Blocked | Capability dropped; seccomp blocks mount |
| 8 | cap_sys_module | Runtime | CAP_SYS_MODULE allows loading malicious kernel modules | Blocked | Capability dropped; kernel.modules_disabled=1 |
| 9 | cap_dac_read_search | Runtime | CAP_DAC_READ_SEARCH + open_by_handle_at reads host files | Blocked | Capability dropped; seccomp blocks open_by_handle_at |
| 10 | hostpath | Runtime | HostPath volume mounts expose host filesystem | Blocked | Only .devcontainer (read-only) and workspace copy mounted |
| 11 | runc_2019 | Runtime | CVE-2019-5736 — runc binary overwrite via /proc/self/exe | Blocked | No runc; no container runtime |
| 12 | runc_2024 | Runtime | CVE-2024-21626 — runc working directory file descriptor leak | Blocked | No runc; no container runtime |
| 13 | pid_ns | Kernel | PID namespace escape via /proc to access host processes | Blocked | Separate kernel; /proc shows only guest processes |
| 14 | cgroup | Kernel | cgroup release_agent write for host code execution | Blocked | Separate kernel; cgroup release_agent disabled |
| 15 | bpf_privesc | Kernel | eBPF program loading for privilege escalation | Blocked | kernel.unprivileged_bpf_disabled=1; CAP_BPF dropped |
| 16 | dirty_cow | Kernel | CVE-2016-5195 — copy-on-write race condition for privilege escalation | Blocked | Separate kernel; exploit affects guest only; KASLR enabled |
| 17 | dirty_pipe | Kernel | CVE-2022-0847 — pipe buffer flag manipulation for file overwrite | Blocked | Separate kernel; exploit affects guest only; no host files accessible |
| 18 | packet_sock | Kernel | CAP_NET_RAW + AF_PACKET socket for traffic interception | Blocked | CAP_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
pinnsutility that allows setting arbitrary kernel parameters via specially crafted annotations on a pod. An attacker can setkernel.core_patternto 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_patternis set to a safe value (|/bin/false) andkernel.modules_disabled=1prevents loading modules that could be triggered by core patterns.
2. kubectl cp Path Traversal (CVE-2019-11246)
- Attack:
kubectl cpfollows 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 causeskubectl cpto overwrite host files. - Why N/A: SendBox has no Kubernetes API server, no
kubectl, and nokubelet. 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 podswithhostPID: 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
kubectlanddockerby 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=1allows 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=0is 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
--privilegedgrants 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
--privilegedflag. SendBox never requests--privilegedfrom 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.sockis 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 (
.devcontainerread-only, workspace copy read-write). No host paths like/var/run/are ever exposed. The command policy denylist blocksdockercommands. TheContainerHardening.validate()method warns if any mount targets sensitive paths.
7. CAP_SYS_ADMIN Abuse
- Attack:
CAP_SYS_ADMINis one of the most powerful Linux capabilities. It allows mounting filesystems, usingunshareto 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_ADMINis explicitly dropped in the hardening script. The seccomp profile blocksmount,unshare, andpivot_rootsyscalls.prctl(PR_SET_NO_NEW_PRIVS, 1)prevents regaining capabilities.
8. CAP_SYS_MODULE Abuse
- Attack:
CAP_SYS_MODULEallows loading kernel modules viainit_module/finit_modulesyscalls. 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_MODULEis dropped.kernel.modules_disabled=1is set via sysctl, disabling module loading entirely. The seccomp profile blocksinit_moduleandfinit_modulesyscalls.
9. CAP_DAC_READ_SEARCH + open_by_handle_at
- Attack:
CAP_DAC_READ_SEARCHbypasses file read permission checks. Combined with theopen_by_handle_atsyscall (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_atin the guest kernel operates on guest filesystem handles only. - Defense-in-depth:
CAP_DAC_READ_SEARCHis dropped. The seccomp profile blocksopen_by_handle_at. No sensitive host paths are mounted.
10. HostPath Volume Abuse
- Attack: Kubernetes
hostPathvolumes or Docker-v /:/hostmounts 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
runcbinary via/proc/self/exe. Whenruncis 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/exeinside 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),/procshows host processes. An attacker can use/proc/<pid>/rootto access the host filesystem or inject code into host processes viaptrace. - Why N/A: The guest has its own kernel and PID space.
/procshows only guest processes. There is no--pid=hostoption. - Defense-in-depth:
kernel.yama.ptrace_scope=2is set (no process may ptrace another, except viaCAP_SYS_PTRACEwhich is dropped).CAP_SYS_PTRACEis dropped. The seccomp profile blocksptrace.
14. Cgroup release_agent Escape
- Attack: An attacker with write access to cgroup files can set
release_agentto a path on the host, andnotify_on_releaseto1. When the last process in the cgroup exits, the kernel executes therelease_agentbinary 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_agentinside the VM triggers execution inside the VM, not on the host. - Defense-in-depth: The hardening script disables
release_agentby writing0tonotify_on_releasefor all existing cgroups and making cgroup mount points read-only where possible.CAP_SYS_ADMIN(required to modify cgrouprelease_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(orCAP_SYS_ADMINon 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=1prevents non-root BPF usage. The seccomp profile blocks thebpfsyscall.CAP_SYS_ADMINand 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/passwdor 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/passwdfor 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_RAWallows creatingAF_PACKETsockets 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_PACKETsockets, 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_RAWis 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 Parameter | Value | Purpose |
|---|---|---|
kernel.modules_disabled | 1 | Prevent kernel module loading (blocks CAP_SYS_MODULE exploitation) |
kernel.unprivileged_bpf_disabled | 1 | Prevent unprivileged BPF program loading |
kernel.yama.ptrace_scope | 2 | Restrict ptrace to CAP_SYS_PTRACE holders only (which is dropped) |
kernel.core_pattern | |/bin/false | Prevent core_pattern pipe injection (CRI-O CVE vector) |
kernel.randomize_va_space | 2 | Full ASLR (code, data, stack, heap, vdso) |
net.ipv4.conf.all.route_localnet | 0 | Prevent routing to loopback from external interfaces |
kernel.kptr_restrict | 2 | Hide kernel pointers from all users |
kernel.dmesg_restrict | 1 | Restrict dmesg access to CAP_SYSLOG holders |
kernel.perf_event_paranoid | 3 | Disable perf events for non-root users |
net.ipv4.conf.all.send_redirects | 0 | Disable ICMP redirect sending |
net.ipv4.conf.all.accept_redirects | 0 | Disable ICMP redirect acceptance |
fs.protected_symlinks | 1 | Prevent symlink-based attacks in world-writable directories |
fs.protected_hardlinks | 1 | Prevent hardlink-based privilege escalation |
fs.suid_dumpable | 0 | Prevent 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:
| Capability | Risk if Granted |
|---|---|
CAP_SYS_ADMIN | Mount filesystems, create namespaces, trace processes — most common escape vector |
CAP_SYS_MODULE | Load kernel modules — arbitrary kernel code execution |
CAP_DAC_READ_SEARCH | Bypass file read permissions — used with open_by_handle_at for host file access |
CAP_NET_RAW | Create raw/packet sockets — traffic interception, ARP spoofing |
CAP_SYS_PTRACE | Trace any process — code injection, credential theft |
CAP_SYS_RAWIO | Direct I/O port access — hardware-level attacks |
CAP_SYS_BOOT | Reboot the system |
CAP_SYS_CHROOT | Use chroot — filesystem isolation escape |
CAP_MKNOD | Create device nodes — potential device access bypass |
CAP_NET_ADMIN | Modify network configuration — firewall bypass |
CAP_DAC_OVERRIDE | Bypass file write permissions |
CAP_FOWNER | Bypass permission checks on file operations |
CAP_SETUID / CAP_SETGID | Change 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 Syscall | Attack Prevented |
|---|---|
mount / umount2 | Filesystem namespace escape |
init_module / finit_module / delete_module | Kernel module loading |
open_by_handle_at | File handle-based host file access (CVE technique) |
ptrace | Process tracing and code injection |
bpf | eBPF program loading for kernel exploitation |
unshare | Namespace creation for isolation escape |
pivot_root | Root filesystem manipulation |
kexec_load / kexec_file_load | Kernel replacement |
reboot | System reboot |
swapon / swapoff | Swap manipulation |
acct | Process accounting manipulation |
add_key / keyctl / request_key | Kernel keyring manipulation |
userfaultfd | Used in exploitation of race conditions |
perf_event_open | Kernel-level performance monitoring (information leak) |
move_mount / open_tree / fsopen / fspick | New mount API — filesystem manipulation |
process_vm_readv / process_vm_writev / pidfd_getfd / kcmp | Cross-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-LengthJSON-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/listis correlated and filtered, while everytools/calluses 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/cwdoverrides 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(allowssudoinside 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_PRIVSset (prevents any privilege escalation)- Additional capabilities dropped (
CAP_SETUID,CAP_SETGID,CAP_FOWNER) - Stricter seccomp profile (blocks
clone3,io_uring_*) - cgroup
release_agentexplicitly disabled /procand/sysremounted 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_SERVICEretained — and only if not in Maximum mode)
Threat Model
In Scope
These are threats SendBox is designed to defend against:
| Threat | Defense |
|---|---|
| Agent attempts to access host filesystem | VM isolation — no host filesystem visible; only explicit virtiofs mounts |
| Agent attempts to contact unauthorized network endpoints | Network firewall — default-deny with domain allowlist |
| Agent overrides npm's registry or requests an upstream tarball directly | Kernel 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 APIs | Pre-delivery verification and non-executing archive inspection with fail-closed verdicts; npm scripts are disabled in the workload |
| Compromised package proxy attempts direct external access | Separate registry cgroup can reach only the trusted loopback SOCKS listener and cannot set SO_MARK |
| Agent attempts to obtain a private registry token | Registry credential is isolated in the authenticated proxy bootstrap and never enters workload secrets or environment |
| Agent attempts to execute dangerous commands | Command policy — allowlist/denylist with pipeline parsing |
| Agent attempts to escalate privileges within the VM | Capability dropping, seccomp, PR_SET_NO_NEW_PRIVS, sysctl hardening |
| Agent attempts to exfiltrate secrets | Secrets are env vars, not files; network firewall blocks unauthorized endpoints |
| Agent attempts to exploit kernel vulnerabilities | Separate guest kernel; guest compromise is contained by the selected hypervisor |
| Agent attempts to escape via host runtime bugs | Apple provider avoids OCI runtimes; Kata provider relies on patched containerd, Kata shim, and hypervisor components |
| Agent attempts cloud metadata access | route_localnet disabled and metadata endpoints must remain outside the network allowlist |
| Agent attempts to intercept network traffic | CAP_NET_RAW dropped; separate virtual NIC |
| Agent attempts to load malicious kernel modules | kernel.modules_disabled=1; CAP_SYS_MODULE dropped; seccomp blocks init_module |
| Agent attempts a disallowed MCP tool call | The 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 branch | Root-installed git policy validates current and remote refs; eBPF terminates direct real-git execution |
| Agent reads back host keystrokes it was never sent | Terminal 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 launcher | The 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 logs | Event, ClientFrame, TerminalCommand, LauncherControl and HostTerminalCommand all render input as a byte count, never as content |
| Agent stalls cancellation by refusing to read its terminal | Control 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:
| Threat | Reason |
|---|---|
| Hardware side-channel attacks (Spectre, Meltdown) | Requires CPU microcode/hardware mitigations; beyond hypervisor scope |
| Attacks against the selected hypervisor or host runtime | Provider components must be patched by Apple, Kata, containerd, and the operating-system vendor |
| Physical access attacks | Physical access bypasses all software security |
| Social engineering of the host user | User-level risk; SendBox cannot prevent the user from disabling protections |
| Denial-of-service against the host | VM resource limits (CPU/memory) mitigate but don't eliminate resource exhaustion |
| Supply chain attacks on the base VM image | Image provenance and signing are the user's responsibility |
| Proving arbitrary package source code is safe | Static package findings are policy signals, not a complete malware detector |
| Zero-day hypervisor escapes | No software sandbox can eliminate hypervisor zero-day risk |
| Semantic authorization of separately launched local MCP binaries or alternate local clients | Protocol 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 clients | The 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.
| CVE | Description | SendBox Mitigation |
|---|---|---|
| CVE-2022-0811 | CRI-O kernel parameter injection | No CRI-O; core_pattern locked |
| CVE-2019-11246 | kubectl cp symlink traversal | No kubectl; explicit virtiofs mounts |
| CVE-2019-5736 | runc binary overwrite via /proc/self/exe | Apple provider has no runc; Kata workload runs behind a VM boundary |
| CVE-2024-21626 | runc fd leak for host filesystem access | Apple provider has no runc; Kata workload does not share the host mount namespace |
| CVE-2016-5195 | Dirty COW — COW race condition | Separate kernel; host is XNU |
| CVE-2022-0847 | Dirty Pipe — pipe buffer flag manipulation | Separate 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