<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6" -->

---
title: Software sandboxing: The basics (2025) | daily.dev
description: A deep technical exploration of software sandboxing concepts and mechanisms, drawing on experience building sandboxing support for the Emilua Lua runtime....
canonical: https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Software sandboxing: The basics (2025) | daily.dev
og:description: A deep technical exploration of software sandboxing concepts and mechanisms, drawing on experience building sandboxing support for the Emilua Lua runtime....
og:url: https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6
og:image: https://api.daily.dev/og/posts/aUazXDqh6.png
og:image:alt: Software sandboxing: The basics (2025)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Software sandboxing: The basics (2025)

**[Lobsters](https://daily.dev/sources/lobsters)** · 45 min read · 0 upvotes · 0 comments

## Summary

A deep technical exploration of software sandboxing concepts and mechanisms, drawing on experience building sandboxing support for the Emilua Lua runtime. Covers the definition of discretionary privilege dropping, why suid binaries and Linux namespaces are poor sandboxing primitives, how the actor model combined with capability-based security (using file descriptors as capabilities and UNIX domain sockets for message passing) provides a solid foundation, and a detailed comparison of FreeBSD's Capsicum against Linux's Seccomp and namespaces. Includes practical code examples for oblivious sandboxing via LD_PRELOAD/libc interposition, dlopen-by-fd tricks for native plugins, non-blocking IO pitfalls, and Kafel as a way to manage reusable Seccomp policies.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.emilua.org/2025/01/12/software-sandboxing-basics>

## Questions this post answers

### Why is Capsicum considered a better sandboxing mechanism than Linux seccomp?

Capsicum required only about 100 lines of code to sandbox Chromium, compared to roughly 11,301 lines for seccomp and 22,350 for Windows ACLs, according to research comparing sandboxing mechanisms. Capsicum works by disabling ambient authority entirely via cap_enter, so all resource access must go through already-open file descriptors, avoiding the syscall-arch and blacklist/whitelist complexity that plagues seccomp on Linux.

_Comparing sandboxing approaches like Capsicum and seccomp is easier when developers track hands-on security writeups on daily.dev._

### Why are Linux user namespaces considered risky for sandboxing untrusted code?

Within a nested user namespace, a process runs as superuser inside that namespace, exposing kernel code paths normally reserved for the real superuser to every unprivileged user. Andy Lutomirski warned that CLONE_NEWUSER granting CAP_NET_ADMIN over any network namespace, including the ability to program iptables, is a huge privilege-escalation risk, since over a decade of kernel code was never written expecting unprivileged access to those paths.

_Developers weighing namespaces against safer sandboxing primitives can follow deep technical breakdowns like this on daily.dev._

### How can file descriptors be used as capabilities for sandboxing on UNIX systems?

UNIX systems generally check permissions only when a file descriptor is created, not when an already-open descriptor is used, which matches the capability model: owning the descriptor implies the access rights. This is demonstrated by an unprivileged process successfully reading /etc/shadow through a descriptor inherited from a privileged one via setpriv. The main exception is ioctls, which can bypass this convention, so untrusted file descriptors should avoid ioctl operations like isatty().

_Engineers designing capability-based sandboxes can dig into practical fd-handling patterns like this on daily.dev._

## Community take

How the wider developer community reacted, aggregated from 6 discussions and 46 comments across lobsters, hackernews (as of 2026-09-21).

**TL;DR:** Discussion centers on why capability-based sandboxing (Capsicum) never caught on despite technical praise, contrasted with OpenBSD's pledge/unveil which are widely seen as simpler and more successful, while others debate namespaces, seccomp, and VM-based alternatives.

**Sentiment:** 20% positive · 55% mixed · 25% skeptical

**The case for**

- Capsicum is praised as a technically excellent, arguably superior sandboxing design.
- Pledge and unveil are held up as proof that a simple, low-effort API can achieve broad real-world adoption.
- Capability-based approaches are seeing a resurgence via WASI/WASM which has no ambient authority to begin with.

**The pushback**

- Capsicum requires significant program restructuring (or at least LD_PRELOAD shims) to adopt, unlike drop-in APIs like pledge/unveil or Landlock.
- Capsicum stayed FreeBSD-specific and BSD fragmentation (competing APIs across FreeBSD/OpenBSD/NetBSD) hurt its chances of cross-platform adoption.
- Google reportedly rejected Capsicum patches for Chromium on NIH/target-support grounds rather than technical merit.
- Enabling unprivileged user namespaces (needed for tools like unshare/bubblewrap) is argued to expand kernel attack surface even when a given program doesn't use them.
- Seccomp is considered complex and brittle to configure correctly compared to simpler alternatives.

**By community**

- lobsters (heated): A long back-and-forth over whether Capsicum truly requires rewriting programs turns into a broader debate about why it failed to gain adoption versus OpenBSD's pledge/unveil, plus a side thread on whether unshare/user-namespaces meaningfully increase attack surface.
- hackernews (mixed): Comments range over Unix's ambient-authority design, alternatives like Fuchsia's capability-first model, VM/hypervisor-based sandboxing (Firecracker, Qubes, qemu), and a rehash of the Capsicum-vs-pledge adoption debate.

**Hottest debate:** Whether Capsicum's lack of adoption stems from a genuinely harder integration burden versus political/NIH rejection and BSD ecosystem fragmentation, versus pledge/unveil's simplicity being the real reason for their success.

**Open questions**

- Why did Capsicum fail to gain traction even within the BSD ecosystem despite technical praise?
- Is enabling unprivileged user namespaces by default actually a net security risk given how widely it's now enabled?
- Would implementing pledge-like semantics in glibc via seccomp BPF actually work well on Linux?

**Highlights**

> It also puzzles me. I'll try to answer below, but we'll never know the answer so my guess is as good as any. For outsiders, BSD is a confusing ecosystem. You have FreeBSD, NetBSD, OpenBSD, and DragonFly BSD. For outsiders, there's no criteria to favor one over the other, nor any criteria to adhere to some "official" flavor. If Chrome (or Firefox) added support for Capsicum, it'd only support FreeBSD. Therefore there's no reason for a random maintainer (who's likely an BSD outsider) to accept such PRs (any accepted PR is code that the official team will have to maintain and check against CI, and so on...). IMO fragmentation of basic APIs is only harmful to the whole BSD ecosystem. Basic APIs such as `setresuid()`, `SOCK_SEQPACKET` over `AF_UNIX`, and a lot more are evidence that there's no reason to offer the same functionality under a different API. There's no benefit to gratuitous fragmentation, and fortunately we already sorted many of the issues in the APIs I just mentioned, but there's still a lot of basic stuff that we can't do portably among different BSD systems. For instance, only recently we got memory file descriptors for NetBSD (they existed in FreeBSD for a long time already). If you want to use memory file descriptors on OpenBSD or DragonFly BSD, you have to do the boring loop to avoid name clashes on opening temporary files (and it'll never be as robust and clear as just creating a memory file descriptor). Capsicum isn't as basic as memory file descriptors so it's gonna take longer, but sandboxing is a basic need on modern software development. We don't create sandboxes as frequently only because it's horrendously hard to do so. The APIs that systems provide nowadays are just awful. We do want to create sandboxes. That's why projects such as Tauri gain so much attention. So Capsicum failed to conquer even the BSD ecosystem. Therefore it'll fail even harder to conquer the space outside BSD. Linux will never adopt it. BSD systems fail to agree with each other even on some basic things (again: only recently NetBSD added support for memfd_create). Instead of implementing Linux APIs as BSDs are forced to do nowadays just to compile recent software, they could instead agree on just a few C APIs among themselves first, and then have a better chance at seeing them being adopted on Linux later so they don't need to just accept defeat over whatever Linux folks create, and actually contribute to the larger ecosystem. I believe there's room to respect differences between the philosophies among the BSDs still, but creating incompatible APIs for the same purposes isn't helping anyone. They should innovate on new spaces, not on spaces where they already "lost" and one of the competing approaches already got the right answer. DragonFly BSD has HAMMER. OpenBSD has httpd. FreeBSD has the MAC framework. All innovations on different spaces. They do **not** need to unify on that. They can go their separate ways on that. However why are each one reinventing the APIs for the same basic stuff? Kqueue was a complex API that everyone agreed it was the right approach and just adopted. Kqueue was a victory. Why can't they do the same for Capsicum already?
> — [vinipsmaker on lobsters · 1 points, 2 comments](https://lobste.rs/s/brptxb/software_sandboxing_basics_2025#c_pyj09o)

> the fact it hasn't caught on is a hint that maybe its design isn't ideal? as a clueless noob developer, if someone told me to use selinux/apparmor/capsicum to sandbox my program, it sounds daunting already without even having to start. developer experience is crucial if you're trying to convince developers to sandbox their programs. Pledge/unveil have found pretty much the ideal point on the tradeoff curve to encourage broad adoption, as nearly every program in OpenBSD base and a good chunk of ports has been patched to add them. Reading the manpage for the two syscalls reveals an API that is wonderfully simple, to the point I think anyone mildly competent in C can handle them. I haven't used landlock, but from peeking at the docs page, even it seems more complicated than pledge, and that's supposed to be the "simplified" API.
> — [williewillus on lobsters · 1 points, 2 comments](https://lobste.rs/s/brptxb/software_sandboxing_basics_2025#c_tzrikt)

> The code to implement Chromium’s sandboxing model with Capsicum was an order of magnitude less than that for *any* other platform. The patches were rejected because Google does not accept *any* patches to support targets that Google does not ship Chrome for.  Google engineers implemented Capsicum for Linux. The patches were rejected for NIH reasons.
> — [david\_chisnall on lobsters · 1 points](https://lobste.rs/s/brptxb/software_sandboxing_basics_2025#c_fgtynv)

> > At that time, its researchers have modified Chromium to make use of Capsicum and compared how much effort was required to make use of each sandboxing mechanism within Chromium. [..] If you’re only going to study one sandboxing mechanism in your life, it should be Capsicum. To this date, I have yet to see a better sandboxing mechanism than Capsicum. In the years since it was added, there's a reason you can count on two hands the number of programs using it in FreeBSD. Even less using it effectively, with refactoring, and not just calling cap_enter(). Capsicum Chrome has never been committed to the official FreeBSD ports tree, it was an academic research project from 17 years ago. https://github.com/rwatson/chromium-capsicum https://www.freshports.org/www/chromium/ https://cgit.freebsd.org/ports/log/www/chromium/Makefile?qt=... No browsers on FreeBSD today use Capsicum. Compare that instead to OpenBSD, where the Chromium port has used pledge(2) since January 2016, and unveil(2) since 2018. Enabled by default. The Mozilla Firefox ports also use both pledge and unveil since 2018-2019, and this work has even been accepted upstream. https://marc.info/?l=openbsd-ports-cvs&m=145211683609002&w=2 https://github.com/openbsd/ports/blob/master/www/chromium/pa... https://github.com/openbsd/ports/tree/master/www/chromium/fi...
> — [brynet on hackernews · 1 comments](https://news.ycombinator.com/item?id=49780694)

> Works because OpenBSD has totalitarian control of the ecosystem, just like Windows. Wouldn't work on Linux because what do those flags even mean to the kernel?
> — [mitxela on hackernews · 1 comments](https://news.ycombinator.com/item?id=49785149)

**Source threads**

- [lobsters](https://lobste.rs/s/brptxb/software_sandboxing_basics_2025) · 47 points · 23 comments
- [hackernews](https://news.ycombinator.com/item?id=49778670) · 33 points · 21 comments
- [hackernews](https://news.ycombinator.com/item?id=42675223) · 3 points · 2 comments
- [hackernews](https://news.ycombinator.com/item?id=48147995) · 3 points · 0 comments
- [hackernews](https://news.ycombinator.com/item?id=45826278) · 2 points · 0 comments
- [hackernews](https://news.ycombinator.com/item?id=42693882) · 1 points · 0 comments

## Similar posts on daily.dev

- [Let's discuss sandbox isolation](https://daily.dev/posts/let-s-discuss-sandbox-isolation-qguovwl1h) · Hacker News · 0 upvotes · 0 comments
- [What is Sandbox Security?](https://daily.dev/posts/what-is-sandbox-security--z2gvetsfd) · Docker · 0 upvotes · 0 comments
- [Capsicum vs seccomp: Process Sandboxing — Vivian Voss](https://daily.dev/posts/capsicum-vs-seccomp-process-sandboxing-vivian-voss-9qyb6kgrk) · Hacker News · 0 upvotes · 0 comments
- [seccomp — Unsafe at any speed](https://daily.dev/posts/seccomp-unsafe-at-any-speed-rcohswsdt) · Lobsters · 0 upvotes · 0 comments
- [Every dev should know about AI sandboxes](https://daily.dev/posts/every-dev-should-know-about-ai-sandboxes-cfpxzueug) · Engineer’s Codex · 1 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux)

[View this post on daily.dev](https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Software sandboxing: The basics (2025)","url":"https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6"},"datePublished":"2026-09-20T21:25:29.449Z","dateModified":"2026-09-21T15:27:22.816Z","description":"A deep technical exploration of software sandboxing concepts and mechanisms, drawing on experience building sandboxing support for the Emilua Lua runtime....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cb77b3b2fdd8d3c0c850ea40b14cd69b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cb77b3b2fdd8d3c0c850ea40b14cd69b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux","timeRequired":"PT45M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Software sandboxing: The basics (2025)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/software-sandboxing-the-basics-2025--auazxdqh6#faq","mainEntity":[{"@type":"Question","name":"Why is Capsicum considered a better sandboxing mechanism than Linux seccomp?","acceptedAnswer":{"@type":"Answer","text":"Capsicum required only about 100 lines of code to sandbox Chromium, compared to roughly 11,301 lines for seccomp and 22,350 for Windows ACLs, according to research comparing sandboxing mechanisms. Capsicum works by disabling ambient authority entirely via cap_enter, so all resource access must go through already-open file descriptors, avoiding the syscall-arch and blacklist/whitelist complexity that plagues seccomp on Linux. Comparing sandboxing approaches like Capsicum and seccomp is easier when developers track hands-on security writeups on daily.dev."}},{"@type":"Question","name":"Why are Linux user namespaces considered risky for sandboxing untrusted code?","acceptedAnswer":{"@type":"Answer","text":"Within a nested user namespace, a process runs as superuser inside that namespace, exposing kernel code paths normally reserved for the real superuser to every unprivileged user. Andy Lutomirski warned that CLONE_NEWUSER granting CAP_NET_ADMIN over any network namespace, including the ability to program iptables, is a huge privilege-escalation risk, since over a decade of kernel code was never written expecting unprivileged access to those paths. Developers weighing namespaces against safer sandboxing primitives can follow deep technical breakdowns like this on daily.dev."}},{"@type":"Question","name":"How can file descriptors be used as capabilities for sandboxing on UNIX systems?","acceptedAnswer":{"@type":"Answer","text":"UNIX systems generally check permissions only when a file descriptor is created, not when an already-open descriptor is used, which matches the capability model: owning the descriptor implies the access rights. This is demonstrated by an unprivileged process successfully reading /etc/shadow through a descriptor inherited from a privileged one via setpriv. The main exception is ioctls, which can bypass this convention, so untrusted file descriptors should avoid ioctl operations like isatty(). Engineers designing capability-based sandboxes can dig into practical fd-handling patterns like this on daily.dev."}}]}
```

