Sandboxing is the practice of running code in an isolated environment so that if it is compromised or misbehaves, it cannot reach the rest of the system. A sandbox restricts what a program can see and do, such as which files it can open, which system calls it can make and which networks it can reach. Browsers, mobile apps and container platforms all use forms of it.

Its value is damage limitation. If an attacker takes control of a sandboxed component, they are confined to what that sandbox allows, and need a further flaw to break out. Sandboxing is therefore often used for software that handles untrusted input.

Sandboxes are not perfect. A vulnerability in the sandbox itself, or in the kernel that enforces it, can allow an escape. Containers are a good example: they share the host kernel, so a kernel flaw can in some cases let code break out, which makes them weaker isolation than a separate virtual machine. A sandbox that is configured too permissively also offers little protection.

To use sandboxing well, apply the tightest restrictions that still let the software work, keep the sandbox technology and the kernel updated, and treat it as one layer of defense rather than a guarantee. For higher-risk workloads, consider stronger isolation such as separate virtual machines.