← @bgSponge

Software sandboxing: The basics

Summary

The Emilua author's long field guide defines software sandboxing as discretionary privilege dropping a process can do programmatically without admin rights.

  1. Sandbox means discretionary privilege dropping.

    Restrict a process programmatically, without administrative authority, by dropping ambient rights rather than raising them via suid helpers.

    Privileges should only ever decrease, never increase (principle of least privilege).

  2. Namespaces are for containers, not sandboxes.

    Nested user namespaces expose CAP_NET_ADMIN-class kernel paths to every user; Landlock and newer restrictors avoid that explosion.

    Linux namespaces is a terrible interface for software sandboxing.

  3. Capsicum is the teaching model.

    cap_enter disables ambient authority so only already-held file descriptors work; Chromium needed ~100 LOC with Capsicum versus thousands for seccomp.

  4. Actors plus capabilities compartmentalize.

    Processes as actors message over UNIX domain sockets, send FDs as unforgeable rights, and prove no sandboxed actor holds forbidden combinations.

    If you’re only going to study one sandboxing mechanism in your life, it should be Capsicum.

  5. Linux reality is Seccomp + Landlock.

    Seccomp blacklists rot across arches and new syscalls; Landlock filters the filesystem while you still fight /proc and multiarch numbering.

    For Linux, Seccomp + Landlock is what we have.

Read the original ↗Save to your Sponge

Summarized with Sponge. Quotes are the author’s own words.

More from @bg

All readings →