OS-Level App Isolation: Sandboxes, Containers, VMs

(The image is AI-generated) 
 

 

 

Last updated: December 3, 2026

Every system eventually runs a program with a bug in it. What separates a contained incident from a serious breach is how far a compromised process can reach: which files it can read, which system calls it can make, and which other workloads it can touch. That reach is the blast radius, and operating-system isolation exists to shrink it.

Containers are often sold as a clean answer. The record is more mixed. In 2026 a Linux kernel flaw called Copy Fail reminded everyone that containers share one kernel, Kubernetes made user namespaces generally available, and Microsoft shipped policy-driven containers for AI agents on Windows 11. This guide covers the building blocks, compares what Linux, macOS and Windows actually offer, and marks which popular claims about isolation survive a fact check.

Key takeaways
  • Isolation is a composition. Namespaces, seccomp, capabilities, cgroups and mandatory access control each close a different gap, and none is enough alone.
  • A standard container is packaging with partial isolation. It shares the host kernel, so kernel bugs such as Dirty Pipe (2022) and Copy Fail (2026) can cross container boundaries.
  • SELinux and AppArmor help, but only in enforcing mode, and they are not absolute. One of the runc flaws disclosed in November 2025 could bypass Linux Security Module labels.
  • On macOS, sandbox-exec is deprecated yet widely used, with no supported replacement for third parties. On Windows, AppContainer is a named Microsoft security boundary, while Windows Sandbox is a lightweight virtual machine.
  • For untrusted code or multi-tenant workloads, use a stronger boundary (gVisor, Kata Containers or a microVM) and patch the kernel and container runtime quickly.

The Linux building blocks

Linux isolation rests on four kernel features that are often named in one breath but do different jobs.

Namespaces give a process its own view of a resource. There are separate namespaces for mounts, process IDs, network interfaces, inter-process communication, hostnames (UTS), user and group IDs, control groups and time. A user namespace lets a process look like root inside its sandbox without holding root on the host. The NsJail project documents isolation across UTS, mount, PID, IPC, network, user, cgroup and time namespaces.

Seccomp (secure computing mode) restricts which system calls a process may make. In its filtering form, seccomp-bpf, a program installs a small policy that decides for each call whether to allow it, return an error or kill the process. If a service never needs to load kernel modules or trace other processes, a filter can take those calls away. Docker’s default profile blocks roughly 44 of more than 300 system calls, and Docker describes it as moderately protective with wide compatibility. Treat it as a starting point, not a finished policy.

Capabilities split the all-powerful root privilege into separate units, such as binding to a low port or bypassing file read checks. Docker starts containers with a reduced set by default, and the --privileged flag adds all of them back. The OWASP Docker cheat sheet recommends the opposite habit: drop everything, then add only what the workload needs.

Control groups (cgroups) cap CPU, memory, process count and I/O. They do not hide anything from a process, but they stop one runaway or hostile process from starving the rest of the machine. NsJail, for example, exposes memory, PID and CPU limits.

The practical lesson is that no single feature is enough. Namespaces without a syscall filter leave the full kernel interface exposed. A filter without namespaces still lets a process see the whole host. Strength comes from how completely the pieces are combined.

Mandatory access control: SELinux and AppArmor

Namespaces and seccomp limit what a process can see and call. They do not decide what it may read or write once it can reach a file. That is the job of mandatory access control (MAC), which Linux implements through Linux Security Modules. Policy is set system-wide, so a process cannot lift it by changing its user ID.

SELinux labels processes, files, ports and devices, then allows access only where the policy has an explicit rule. Red Hat’s documentation gives the standard example: the web server runs in the httpd_t domain, may read content labeled httpd_sys_content_t, and is denied access to database files that carry a different type. AppArmor takes a path-based approach, attaching a profile to an executable and listing the paths, network operations and capabilities it may use. Profiles are usually easier to write and audit, while SELinux labels can express finer, system-wide rules.

Two cautions apply. First, MAC protects only in enforcing mode. In SELinux permissive mode the system logs what it would have denied but blocks nothing, and AppArmor’s complain mode behaves the same way. Denials in those logs are useful only if someone reads them, which is where logging, monitoring and auditing in Windows, Linux and macOS becomes part of the isolation story.

Second, MAC is not a guarantee against kernel bugs or runtime flaws. The Linux Foundation’s analysis of Dirty COW noted that SELinux, AppArmor and similar tools could not prevent it. And in the runc advisory published in November 2025, one of the three flaws (CVE-2025-52881) could be used to bypass LSM labels, which weakened a mitigation that many deployments rely on.

Sandboxing on Linux, macOS and Windows

Each operating system packages these ideas differently, and the differences decide what you can realistically enforce.

Linux

On Linux, sandboxing is mostly a userspace assembly of kernel features. Firejail is a SUID sandbox program that restricts an application using namespaces, seccomp-bpf and capabilities. Its default filesystem mounts the main system directories read-only and leaves only /home and /tmp writable. The same man page carries a warning worth repeating: because Firejail is a SUID binary, a bug in it could let a local user reach root, so access to it should be limited to trusted users.

NsJail is a lightweight process isolation tool that combines namespaces, resource limits, filesystem constraints and programmable seccomp-bpf policies. Its README says it is not an official Google product. Bubblewrap is the low-level unprivileged sandboxing tool used by Flatpak. Its own documentation stresses that it is a toolkit rather than a ready-made sandbox: the protection you get is decided by the arguments the calling program passes in.

macOS

macOS sandboxing is built on the Seatbelt technology, which enforces profiles written in the Sandbox Profile Language (SBPL). Apple’s own system services use it, and so does Chromium, which ships its own profile files. The command-line tool sandbox-exec lets anyone run a process under a custom profile.

Apple marks sandbox-exec as deprecated, and an Apple developer-support engineer has said on the developer forums that SBPL was never documented for third-party use, so custom profiles are unsupported. Even so, the tool is still in use. Chromium relies on its profiles, Bazel and Swift Package Manager have used it, and Microsoft’s 2026 Execution Containers use Seatbelt for process containers on macOS. Tool maintainers report that it still works on Sequoia and Tahoe, but I could not find an Apple statement on its future.

My reading: sandbox-exec is useful today but a risky foundation for long-term controls, because enforcement depends on a mechanism Apple does not promise to keep. For Linux workloads on a Mac, Apple’s open-source Containerization framework (macOS 26, Apple silicon) takes a different route and runs each Linux container in its own lightweight virtual machine. That design is Apple’s own description, not an independent evaluation.

Windows

AppContainer runs a process with a restricted token and a limited set of capabilities. Microsoft lists the AppContainer sandbox among the security boundaries it commits to service. Win32 app isolation builds on AppContainer to confine classic desktop applications; Microsoft opened a public preview in 2023 and later described it as close to general availability, but I did not find a final general-availability announcement, so check the current status before planning around it.

Job Objects group processes so they can be limited and terminated together. That is resource management, not a security boundary, and Job Objects are not among the boundaries Microsoft names. Windows Sandbox is a different thing from AppContainer: Microsoft describes it as a lightweight, disposable virtual machine that uses the same hardware-based virtualization as Hyper-V. Hyper-V isolated containers count as a virtual machine boundary, while Windows Server containers share a kernel and are not intended for hostile multi-tenant use.

Sandboxing is only one layer of a Windows baseline. For the rest, including security baselines, attack surface reduction rules and identity controls, see our Windows hardening guide.

Containers: where isolation leaks

A container is not one security mechanism. It is namespaces, cgroups, capabilities, seccomp and optionally MAC, assembled by a runtime such as runc and managed by a platform such as Docker or Kubernetes. That assembly is efficient, which is why it dominates modern deployment.

It is also frequently misconfigured, and even a perfect configuration shares one kernel across every container on the host. Microsoft’s container documentation says plainly that neither Windows Server containers nor Linux containers are a robust boundary for hostile multi-tenant scenarios. Containers are best understood as units of packaging and deployment that add useful isolation, not as miniature virtual machines.

When an escape happens, the pattern is usually the same: an attacker gets code running inside a container through an application bug, a poisoned dependency or stolen credentials, then abuses excess privileges or a kernel or runtime flaw to reach the host. Configuration mistakes make this easier. Running with --privileged, adding broad capabilities such as SYS_ADMIN, or mounting sensitive host paths gives a compromised container a direct way out. The OWASP cheat sheet singles out the Docker socket: mounting it into a container hands that container control of the Docker daemon, and mounting it read-only does not fix the problem.

The table below lists notable cases. It is a summary of public advisories, not an attack guide.

CaseWhenComponentWhat it showed
Dirty COW (CVE-2016-5195)2016Linux kernelA race in copy-on-write handling let local users write to read-only memory. Researchers showed it working from inside containers, including against files on read-only volumes. Docker’s own documentation lists it among bugs its defaults did not mitigate.
CVE-2019-57362019runcA malicious container could overwrite the host’s runc binary, which led to root on the host.
Dirty Pipe (CVE-2022-0847)2022Linux kernelAllowed overwriting read-only files through the page cache. Researchers noted it could alter files shared between containers and data on read-only mounts, and Datadog published a proof of concept that overwrote the host runc binary from an unprivileged container.
Leaky Vessels (CVE-2024-21626 plus three BuildKit CVEs)Jan 2024runc, BuildKitA runc file-descriptor flaw allowed escape through a crafted image or build, at build time and run time. Fixed in runc 1.1.12. No exploitation in the wild was reported at disclosure.
CVE-2025-31133, CVE-2025-52565, CVE-2025-52881Nov 2025runcThree flaws allowing breakout by redirecting writes to sensitive /proc files. One could bypass LSM labels. Fixed in runc 1.2.8, 1.3.3 and 1.4.0-rc.3. Most serious where untrusted images are run.
Copy Fail (CVE-2026-31431)Apr 2026Linux kernel (AF_ALG crypto interface)A reliable local root flaw in kernels since 2017, with a very small public exploit. The page cache is shared, so Microsoft warned of cross-container impact. CISA added it to its exploited-vulnerabilities catalog on May 1, 2026. Fixed in kernels 6.18.22, 6.19.12 and 7.0 and in vendor backports.

The pattern across the table is that the kernel is the weak point no container setting can fully remove. That is the reason the next sections separate hardening from stronger isolation.

Hardening containers in practice

Abandoning containers is not the answer. The better move is to harden the combination so that one failure does not become a total loss. These controls apply across Docker, Podman and Kubernetes.

  • Shrink the image. Fewer packages mean fewer vulnerabilities and fewer tools for an attacker after a foothold. Distroless images ship only the application runtime, and pinning base images by digest rather than by a floating tag keeps builds reproducible.
  • Run as non-root. Add a USER instruction to every Dockerfile. In Kubernetes, the Restricted Pod Security Standard requires non-root containers, dropping all capabilities, disabling privilege escalation and a seccomp profile of RuntimeDefault or Localhost.
  • Use user namespaces. Kubernetes v1.36 (April 2026) made user namespaces generally available. Setting hostUsers: false maps container root to an unprivileged user on the host. Treat it as a mitigation that shrinks blast radius, not as a force field: the kernel is still shared.
  • Make the root filesystem read-only and mount writable volumes only where the application needs to write.
  • Drop capabilities and keep seccomp on. Start from drop-all, add back only what is required, and never disable the default seccomp profile as a shortcut. Docker Engine now blocks AF_ALG sockets in its default profile, a change made in response to Copy Fail.
  • Avoid privileged mode and risky mounts. Do not mount the Docker socket, and be cautious with /proc, /sys and host directories. Use admission policy to enforce this cluster-wide.
  • Keep MAC enforcing. SELinux or AppArmor adds a second layer around the container. It reduces risk but, as the runc and Dirty COW cases show, it does not replace patching.
  • Segment workloads. Separate Kubernetes namespaces, network policies and egress controls limit lateral movement after a compromise.

When a shared kernel is not enough

For untrusted input, multi-tenant services and AI-generated code, the useful question is how much of the host kernel a workload can reach. Three families put something extra between the workload and that kernel.

  • gVisor runs a user-space kernel (the Sentry) that handles most system calls itself, so far fewer reach the host kernel.
  • Kata Containers gives each workload a lightweight virtual machine with its own guest kernel while still running standard container images.
  • Firecracker is a virtual machine monitor that runs microVMs on KVM. It is not itself a container runtime, though a runtime such as Kata can use it.
ApproachKernel the workload talks toTypical useMain trade-off
Standard container (runc)The shared host kernelPackaging and trusted workloadsA kernel bug reaches every container on the host
gVisorA user-space kernel, with a reduced set of host callsUntrusted code that fits its supported system callsImplements only part of the Linux interface; some workloads run slower
Kata ContainersA separate guest kernel per workloadMulti-tenant KubernetesNeeds virtualization support and more resources
Firecracker microVMA separate guest kernel per microVMServerless platforms and code sandboxesNeeds KVM; you maintain the guest image
Apple Containerization (macOS 26)A lightweight VM per containerLinux containers on Apple silicon MacsRequires macOS 26 and Apple silicon

None of these is magic. A 2020 academic study found that both gVisor and Firecracker still execute a substantial amount of host kernel code, and that neither wins on every performance test. Choose by threat model, not by label.

Windows has parallel options: Windows Sandbox for disposable testing of untrusted files, and Hyper-V isolated containers where a virtual machine boundary is needed. Hypervisor-based boundaries sit on top of firmware and boot components, so the boot chain is part of the trust story; our guide to Secure Boot, TPM and certificates covers that layer.

Claim check

I checked the verifiable claims in the source draft against primary documentation and independent coverage. Where a claim could not be confirmed, I removed it or rewrote it.

ClaimStatusNotes
Firejail is a SUID sandbox using namespaces, seccomp-bpf and capabilities, with read-only system directories and only /home and /tmp writableConfirmedMatches the Firejail man page, which also warns about the risk of the SUID design.
Firejail ships ready-made profiles for Firefox, Chromium, VLC and TransmissionUnverifiedFirejail uses per-application profiles, but I did not verify this exact list, so the names were removed.
NsJail isolates UTS, mount, PID, IPC, network, user and cgroup namespaces, with seccomp-bpf and cgroup limitsConfirmedProject README. It also lists the time namespace and states it is not an official Google product.
Ubuntu’s security documentation describes seccomp as how containers limit kernel exposureUnverifiedNot found in my checks. Replaced with Docker’s seccomp documentation.
Apple deprecated sandbox-exec in macOS Sierra (2016)UnverifiedThe deprecation is real. Developers reported the man-page notice at least as far back as macOS 10.12, but I found no Apple source for the exact release, so the year was dropped.
sandbox-exec still works through macOS 26 TahoeUnverifiedTool maintainers report it works on Sequoia and Tahoe. There is no Apple statement either way.
Seatbelt evaluates operations through roughly 300 kernel hooksUnverifiedNo primary source found. Removed.
Every AI agent sandbox tool on macOS uses sandbox-exec or sandbox_initWrongOverstated. VM-based options exist, including Apple’s Containerization framework and VM backends in some sandbox tools.
App Sandbox is entitlement-based and cannot confine arbitrary command-line processesConfirmedBased on developer reports and Apple forum threads, not an Apple statement.
AppContainer is used by Windows SandboxWrongMicrosoft describes Windows Sandbox as a lightweight VM built on Hyper-V technology. AppContainer underpins packaged apps, Win32 app isolation and Windows process containers for AI agents.
Job Objects are resource management, not a security boundaryConfirmedAppContainer is a named boundary in Microsoft’s servicing criteria; Job Objects are not on the list.
Windows isolation is weaker than Linux namespace sandboxing for arbitrary workloadsUnverifiedAn opinion, not a documented fact. Microsoft says Windows Server and Linux containers share similar levels of isolation. The ranking was removed.
Dirty COW enabled writes to read-only files and host-mounted pathsConfirmedNVD describes writes to read-only memory mappings. Aqua researchers showed writes to a protected file on a read-only container volume.
CVE-2019-5736 let attackers overwrite the host runc binaryConfirmedDocumented by Unit 42 and referenced by Datadog.
Dirty Pipe (CVE-2022-0847) enabled writes to read-only filesConfirmedContainer impact reported by Unit 42, CSO and Datadog.
Leaky Vessels (CVE-2024-21626) affected container startup and image buildsConfirmedOne of four CVEs (three in BuildKit). The runc flaw affected both build time and run time; fixed in runc 1.1.12.
A mounted docker.sock is a direct host-root path with no kernel bug neededConfirmedOWASP advises against it and notes that a read-only mount is not a fix.
Containers run as root by defaultConfirmedTrue for Docker defaults; Kubernetes needs the Restricted profile or runAsNonRoot to prevent it.
A container under SELinux or AppArmor stays confined even after escaping its namespaceWrongOverstated. MAC helps but cannot stop every kernel bug, and CVE-2025-52881 could bypass LSM labels. Rewritten as a partial mitigation.
Firecracker is a VM-based container runtimeWrongFirecracker is a virtual machine monitor for microVMs on KVM. Kata Containers is the container runtime that can use it.
Microsoft: Execution Containers enforce policy outside the agent’s control, so an agent cannot grant itself more accessCompany claimFrom Microsoft’s own announcement of October 7, 2026. I found no independent testing yet.
Apple: each Linux container gets VM-level isolation with sub-second start timesCompany claimFrom Apple’s WWDC25 session and project documentation.
Update (December 3, 2026): several 2026 developments bear directly on this topic.
  • Copy Fail (CVE-2026-31431), April 29: disclosed as a reliable Linux kernel privilege escalation. CERT/CC lists container escape as a possible use and recommends blocking AF_ALG sockets through seccomp, AppArmor or eBPF where a patched kernel is not yet installed. Docker said its default profiles before Engine v29.4.3 allowed those sockets, and that a kernel update remains the real fix.
  • Kubernetes v1.36, April 2026: user namespaces reached general availability.
  • Microsoft Execution Containers, October 7: announced as generally available on Windows 11. They offer process, session and WSL containers, with a microVM backend still experimental. Intune management for process containers was described as coming later.

Change log: December 3, 2026 – rewritten, fact-checked and updated with 2026 developments. December 3, 2026 – first published.

What users say

These are community reactions I could find, not a representative survey.

  • Rootless containers and Copy Fail. A blog post testing the exploit against rootless containers drew a Hacker News discussion. The author reported that rootless containers stopped the specific root escalation in the test. Some commenters replied that the underlying write into shared page cache still worked and could corrupt image layers shared between containers. Others thought that blocking the crypto socket by default is a stopgap that will outlive the bug. A similar debate played out on the NethServer forum, where one participant argued that rootless containers do not prevent page-cache corruption.
  • Kernel developer view. A kernel developer who works on the crypto code argued on the oss-security list that the crypto socket interface is a large attack surface and that user-space crypto libraries make it unnecessary for most programs.
  • macOS developers. Developers asking for a supported replacement for sandbox-exec on the Apple Developer Forums were told that the profile language was never meant for third-party use. In a GitHub issue on Apple’s Containerization project, maintainers of a macOS container shim said they depend on sandbox-exec because they found no published alternative.

My take

In sensitive environments, applications should be isolated from each other and from the operating system. Isolation prevents one application’s conflicts, crashes and misconfigurations from turning into system-wide problems. The sources I read support that view, with three points worth adding.

  • Isolation also prevents plain conflicts, not only attacks. Tools such as bubblewrap and Flatpak exist partly so that programs can run with their own library stack instead of fighting over the host’s. Security and stability benefit from the same boundary.
  • A boundary is only as strong as what it shares. The runc flaws and Copy Fail both involved layers that every container on a host depends on. For the most sensitive workloads, I would give them their own kernel through a VM-style boundary rather than rely on the word “container”.
  • Isolation has to be verified, not assumed. SELinux in permissive mode and a default seccomp profile are easy to leave in place and mistake for protection. A configured control that nobody has tested is a weaker control than it looks.

What this means for you

  1. Patch the kernel and the runtime first. Confirm your kernel includes the Copy Fail fix (or a vendor backport), and that runc is at 1.2.8, 1.3.3, 1.4.0-rc.3 or later. On Docker, use Engine v29.4.3 or later or a patched host kernel.
  2. Treat containers as one layer. Run as non-root, drop all capabilities, use a read-only root filesystem and keep the default seccomp profile.
  3. Enforce policy in Kubernetes. Apply the Restricted Pod Security Standard to application namespaces and enable user namespaces with hostUsers: false on v1.36 or later after checking node prerequisites.
  4. Remove easy escapes. Audit for privileged containers, Docker socket mounts and broad host-path mounts.
  5. Keep MAC in enforcing mode and review its denials, rather than switching it to permissive to make an application start.
  6. Use VM-style isolation for untrusted or multi-tenant code. Pick gVisor, Kata Containers or a microVM according to your compatibility and performance needs.
  7. On Windows, prefer AppContainer-based isolation where an application supports it, and use Windows Sandbox for opening untrusted files.
  8. On macOS, do not make sandbox-exec your only long-term control. Plan for a VM-based fallback for anything high risk.

FAQ

Is a container a security boundary?

Only a partial one. A standard container shares the host kernel, so kernel and runtime bugs can cross the boundary. Microsoft says plainly that neither Linux nor Windows Server containers are a robust boundary for hostile multi-tenant use. A VM-based runtime or hypervisor-isolated container is a stronger choice.

Do rootless containers stop kernel bugs like Copy Fail?

They can block some exploitation paths, such as a particular root escalation, but they do not remove a shared-kernel problem. Community testing and discussion suggest the page-cache write itself can still occur. Patching the kernel remains the real fix.

What should I use for running untrusted code?

Prefer a boundary with its own kernel or a user-space kernel, such as a microVM, Kata Containers or gVisor, and combine it with network egress controls. The best choice depends on which system calls the code needs and how much overhead you can accept.

Sources

  1. Firejail man page (Debian): dyn.manpages.debian.org; Arch Linux manual: man.archlinux.org
  2. NsJail project: github.com/google/nsjail
  3. Bubblewrap project: github.com/containers/bubblewrap
  4. Docker seccomp documentation: docs.docker.com; Docker security non-events: docs.docker.com
  5. OWASP Docker Security Cheat Sheet: cheatsheetseries.owasp.org
  6. Red Hat, Getting started with SELinux: docs.redhat.com; permissive domains: docs.redhat.com
  7. Linux Foundation, How Bad Is Dirty COW: linuxfoundation.org
  8. NVD, CVE-2016-5195: nvd.nist.gov; SecurityWeek on Dirty COW and containers: securityweek.com
  9. Unit 42 on CVE-2019-5736: unit42.paloaltonetworks.com
  10. Unit 42 on Dirty Pipe and containers: paloaltonetworks.com; Datadog proof of concept: securitylabs.datadoghq.com; CSO Online: csoonline.com
  11. Leaky Vessels coverage: The Hacker News; Dark Reading
  12. runc advisory (November 2025): oss-security; CNCF summary: cncf.io
  13. Copy Fail, CERT/CC VU#260001: kb.cert.org; Microsoft Security blog: microsoft.com; The Hacker News on CISA KEV: thehackernews.com; Docker mitigation post: docker.com
  14. Kubernetes Pod Security Standards: kubernetes.io; user namespaces GA in v1.36: kubernetes.io
  15. Blending containers and VMs: a study of Firecracker and gVisor (VEE 2020): par.nsf.gov
  16. Chromium macOS sandbox design: chromium.org; Apple Developer Forums: thread 661939, thread 777509; Swift Forums: sandbox-exec is deprecated
  17. Apple Containerization: github.com/apple/containerization; WWDC25 session: developer.apple.com; GitHub issue on sandbox-exec: issue 737
  18. Microsoft Learn, Windows Sandbox architecture: learn.microsoft.com; application isolation overview: learn.microsoft.com; container security: learn.microsoft.com
  19. Microsoft Security Servicing Criteria for Windows: microsoft.com/msrc
  20. Microsoft, Win32 app isolation preview coverage: BleepingComputer
  21. Microsoft Execution Containers announcement (October 7, 2026): blogs.windows.com; independent coverage: eSecurity Planet
  22. Community discussion: Hacker News (alt.hn mirror); NethServer forum; oss-security

Post a Comment

0Comments

Post a Comment (0)