CAPSICUM(4)
π CAPSICUM(4) β like, the capability & sandbox framework, bestie
okay so real talk, this is the CAPSICUM page from the Kernel Interfaces Manual, and it's genuinely one of the most iconic kernel features ever. let's get into it π«Ά
β¨ NAME β¨
Capsicum β the lightweight OS capability and sandbox framework. yes, that's the whole name. she's lowkey humble about it π
πΈ SYNOPSIS πΈ
options CAPABILITY_MODE
options CAPABILITIES
yep, that's it. two kernel options. that's the whole vibe check π
π¦ DESCRIPTION π¦
so Capsicum is a lightweight OS capability and sandbox framework that implements a hybrid capability system model. and the way it does this? it deliberately blends capabilities with UNIX. like, she's not trying to replace UNIX, she's trying to sit next to her at lunch π
this approach gets you a bunch of the benefits of least-privilege operation, while keeping existing UNIX APIs and performance intact. and it also hands application authors an actual adoption path for capability-oriented design β no cap, that's the good part.
Capabilities are unforgeable tokens of authority. they can be delegated, and you must present them to perform an action. Capsicum makes file descriptors into capabilities. periodt β¨
Capsicum is used for application and library compartmentalisation β that's the decomposition of larger bodies of software into isolated (sandboxed) components, so you can actually implement security policies and limit the impact of software vulnerabilities. very demure, very mindful, very secure π§
π the two core kernel primitives
capability mode
a process mode, entered by invoking cap_enter(2), where access to global OS namespaces (think the file system and PID namespaces) is restricted. only explicitly delegated rights β the ones referenced by memory mappings or file descriptors β may be used. once the flag is set, it's inherited by future children processes, and it may not be cleared. like, it's forever, bestie. no take-backs π
access to system calls in capability mode is restricted: some system calls that need global namespace access are just unavailable, and others get constrained. for instance, sysctl(2) can query process-local info like address space layout, but it can also monitor a system's network connections. so sysctl(2) is constrained by explicitly marking about 60 of over 15000 parameters as permitted in capability mode β every other one is denied. roughly 60 out of 15000. that's not a vibe check, that's a vibe massacre π
the system calls that require constraints are sysctl(2), shm_open(2) (which is allowed to create anonymous memory objects but not named ones), and the openat(2) family of system calls. the openat(2) calls already accept a file descriptor argument as the directory to perform the open(2), rename(2), etc. relative to β and in capability mode the openat(2) family gets constrained so they can only operate on objects βunderβ the provided file descriptor. under. like underneath. stay in your lane, bestie π
capabilities
these limit the operations you can call on file descriptors. example time: a file descriptor returned by open(2) can be refined using cap_rights_limit(2) so that only read(2) and write(2) can be called on it β but not fchmod(2). she can read, she can write, she cannot fchmod. main character energy with boundaries π
the complete list of capability rights lives in the rights(4) manual page. go read it, iykyk.
π sometimes Capsicum needs alternatives to classic POSIX APIs
in some cases, Capsicum requires you to use alternatives to traditional POSIX APIs in order to name objects using capabilities instead of global namespaces:
process descriptorsβ file descriptors representing processes! these let parent processes manage child processes without needing access to the PID namespace. the full tea is inprocdesc(4).anonymous shared memoryβ an extension to the POSIX shared memory API that supports anonymous swap objects associated with file descriptors. again,shm_open(2)has the details.
β and sometimes Capsicum limits your parameter values
in some cases, Capsicum limits the valid values of some parameters to traditional APIs in order to restrict access to global namespaces:
process IDsβ processes can only act upon their own process ID with syscalls such ascpuset_setaffinity(2). mind your own business, honestly π
π bonus FreeBSD functionality (not part of Capsicum itself)
FreeBSD provides some extra functionality to support application sandboxing that is not part of Capsicum itself:
capsicum_helpers(3)β a set of inline functions which simplify modifying programs to useCapsicum. she's a little helper π₯Ίlibcasper(3)β a library that provides services for sandboxed applications, like operating on files specified on a command line, or establishing network connections. iconic behaviour fr fr
π₯ SEE ALSO π₯
cap_enter(2), cap_fcntls_limit(2), cap_getmode(2), cap_ioctls_limit(2), cap_rights_limit(2), fchmod(2), open(2), pdfork(2), pdgetpid(2), pdkill(2), pdwait4(2), read(2), shm_open(2), write(2), cap_rights_get(3), capsicum_helpers(3), libcasper(3), procdesc(4)
πΈ HISTORY πΈ
Capsicum first appeared in FreeBSD 9.0, and was developed at the University of Cambridge. academic baddie behaviour π
π AUTHORS π
Capsicum was developed by:
- Robert Watson
<rwatson@FreeBSD.org> - Jonathan Anderson
<jonathan@FreeBSD.org>
β¦at the University of Cambridge, plus:
- Ben Laurie
<benl@FreeBSD.org> - Kris Kennaway
<kris@FreeBSD.org>
β¦at Google, Inc., and:
- Pawel Jakub Dawidek
<pawel@dawidek.net>
also! portions of this manual page are drawn from Robert N. M. Watson, Jonathan Anderson, Ben Laurie, and Kris Kennaway, βCapsicum: practical capabilities for UNIXβ, USENIX Security Symposium, August 2010, DOI: 10.5555/1929820.1929824. cite your sources, besties π
ok that's the whole page π«Ά go sandbox something and stay safe out there. remember: capability mode is forever, and so is this hyperfixation.
Debian Β· January 23, 2026 Β· CAPSICUM(4) β mwah, love u, bye ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2011, 2013 Robert N. M. Watson
- Copyright (c) 2011 Jonathan Anderson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms