A microVM, not a container
Each sandbox is a lightweight virtual machine:- Its own Linux kernel, supplied by microsandbox (built from libkrunfw), not your host kernel.
- Its own memory and virtual CPUs, scheduled by a hardware hypervisor (KVM on Linux, Apple’s Hypervisor.framework on macOS) through the libkrun VMM.
- A fixed, small set of virtual devices as its only window to the outside.
Host process privileges
The per-sandbox process runs as the same user that launched it. It does not need to be root:- Linux. It needs access to
/dev/kvm, usually through membership in thekvmgroup. No setuid, no elevated capabilities. - macOS. The binary is code-signed with the hypervisor entitlement so it can use Hypervisor.framework.
The device attack surface
The guest can touch the host only through paravirtual (virtio) devices. That fixed list is the host-facing attack surface:| Device | What it carries |
|---|---|
virtio-console | The control channel to agentd |
virtio-net | Network frames into the host network stack |
virtio-fs | Host directories you explicitly mount |
virtio-blk | The root filesystem and any attached disks |
virtio-rng | Entropy |
The host-guest control channel
Your application and themsb CLI drive a sandbox over a single control channel: framed messages on virtio-console, spoken by agentd, the agent that runs as PID 1 inside the guest. The host sends requests like run this command, read this file, or open this TCP connection, and the guest streams back the results.
- The channel is host-driven. The guest answers requests and streams output. It cannot reach back through the channel to run commands on your host or open host-side connections. When a sandbox opens a TCP connection,
agentdmakes it from inside the guest, subject to the sandbox’s network policy. The host never connects to an arbitrary target on the guest’s behalf. - The channel has no cryptographic authentication, and doesn’t need one. It is a virtio device wired to exactly one VM, so the hypervisor’s device model guarantees that only that sandbox’s host process is on the other end. A compromised guest can send any well-formed frame, but only ever to its own host process, which treats every frame as untrusted input.
In-guest privilege
Inside the guest the default is permissive, and that is intentional, because the VM is the boundary:agentdruns as PID 1 (root).- Workload commands run as root by default. Set a non-root user when the workload doesn’t need it.
- The default profile keeps normal root semantics so real-world images work unchanged, including init systems,
sudo, and Docker-in-Docker.
no_new_privs, drops the mount-admin capability from user commands, and forces nosuid,nodev on user mounts. It is incompatible with workloads that need those, such as sudo or Docker-in-Docker.
In-guest root is not host root. Guest root is acceptable because of the VM boundary above it. The restricted profile shrinks the blast radius inside the guest. It is not what stands between the workload and your host. The hypervisor is.