What is a sandbox escape?

A sandbox escape is a way for code to leave its sandbox. The code can then reach the host or other sandboxes.

Updated

How a container escape happens

A container shares the kernel of its host. CVE-2019-5736 is a flaw in runc, a container runtime. An attacker who can run a command as root in a container can overwrite the host runc binary and gain root on the host.

Kernel bugs

A kernel bug can also let code escape. CVE-2022-0185 is a heap-based buffer overflow in the Linux kernel's Filesystem Context code. A local user can use it to gain higher privileges. Exploitation needs unprivileged user namespaces, or namespaced CAP_SYS_ADMIN if those are disabled.

Why own-kernel isolation lowers the risk

A microVM has its own guest kernel. A kernel bug in the guest does not give direct access to the host kernel. The code must also get past the hypervisor. Firecracker's design says: "The first layer of isolation is provided by the Linux KVM and the Firecracker virtualization boundary."

gVisor takes a different route. It runs a user-space kernel in front of the host. Its documentation says: "No system call is passed through directly to the host."

What it does not do

Isolation lowers the risk. It does not remove the risk. gVisor's documentation says: "A sandbox is not a substitute for a secure architecture."

Related terms

All glossary terms

Related