---
name: "capsicum"
section: "4"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/capsicum"
---

# capsicum(4)

lightweight OS capability and sandbox framework

## NAME

**Capsicum** – lightweight OS capability and sandbox framework

## SYNOPSIS

**options CAPABILITY\_MODE** **options CAPABILITIES**

## DESCRIPTION

**Capsicum** is a lightweight OS capability and sandbox framework implementing a hybrid capability system model. **Capsicum** is designed to blend capabilities with UNIX. This approach achieves many of the benefits of least-privilege operation, while preserving existing UNIX APIs and performance, and presents application authors with an adoption path for capability-oriented design.

Capabilities are unforgeable tokens of authority that can be delegated and must be presented to perform an action. **Capsicum** makes file descriptors into capabilities.

**Capsicum** can be used for application and library compartmentalisation, the decomposition of larger bodies of software into isolated (sandboxed) components in order to implement security policies and limit the impact of software vulnerabilities.

**Capsicum** provides two core kernel primitives:

- capability mode

  A process mode, entered by invoking [cap\_enter(2)](/cap_enter/2.md), in which access to global OS namespaces (such as the file system and PID namespaces) is restricted; only explicitly delegated rights, referenced by memory mappings or file descriptors, may be used. Once set, the flag is inherited by future children processes, and may not be cleared.

  Access to system calls in capability mode is restricted: some system calls requiring global namespace access are unavailable, while others are constrained. For instance, [sysctl(2)](/sysctl/2.md) can be used to query process-local information such as address space layout, but also to monitor a system's network connections. [sysctl(2)](/sysctl/2.md) is constrained by explicitly marking ≈60 of over 15000 parameters as permitted in capability mode; all others are denied.

  The system calls which require constraints are [sysctl(2)](/sysctl/2.md), [shm\_open(2)](/shm_open/2.md) (which is permitted to create anonymous memory objects but not named ones) and the [openat(2)](/openat/2.md) family of system calls. The [openat(2)](/openat/2.md) calls already accept a file descriptor argument as the directory to perform the [open(2)](/open/2.md), [rename(2)](/rename/2.md), etc. relative to; in capability mode the [openat(2)](/openat/2.md) family of system calls are constrained so that they can only operate on objects “under” the provided file descriptor.

- capabilities

  Limit operations that can be called on file descriptors. For example, a file descriptor returned by [open(2)](/open/2.md) may be refined using [cap\_rights\_limit(2)](/cap_rights_limit/2.md) so that only [read(2)](/read/2.md) and [write(2)](/write/2.md) can be called, but not [fchmod(2)](/fchmod/2.md). The complete list of the capability rights can be found in the [rights(4)](/rights/4.md) manual page.

In some cases, **Capsicum** requires use of alternatives to traditional POSIX APIs in order to name objects using capabilities rather than global namespaces:

- process descriptors

  File descriptors representing processes, allowing parent processes to manage child processes without requiring access to the PID namespace; described in greater detail in [procdesc(4)](/procdesc/4.md).

- anonymous shared memory

  An extension to the POSIX shared memory API to support anonymous swap objects associated with file descriptors; described in greater detail in [shm\_open(2)](/shm_open/2.md).

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 as [cpuset\_setaffinity(2)](/cpuset_setaffinity/2.md).

FreeBSD provides some additional functionality to support application sandboxing that is not part of **Capsicum** itself:

- [capsicum\_helpers(3)](/capsicum_helpers/3.md)

  A set of a inline functions which simplify modifying programs to use **Capsicum**.

- [libcasper(3)](/libcasper/3.md)

  A library that provides services for sandboxed applications, such as operating on files specified on a command line or establishing network connections.

## SEE ALSO

[cap\_enter(2)](/cap_enter/2.md), [cap\_fcntls\_limit(2)](/cap_fcntls_limit/2.md), [cap\_getmode(2)](/cap_getmode/2.md), [cap\_ioctls\_limit(2)](/cap_ioctls_limit/2.md), [cap\_rights\_limit(2)](/cap_rights_limit/2.md), [fchmod(2)](/fchmod/2.md), [open(2)](/open/2.md), [pdfork(2)](/pdfork/2.md), [pdgetpid(2)](/pdgetpid/2.md), [pdkill(2)](/pdkill/2.md), pdwait4(2), [read(2)](/read/2.md), [shm\_open(2)](/shm_open/2.md), [write(2)](/write/2.md), [cap\_rights\_get(3)](/cap_rights_get/3.md), [capsicum\_helpers(3)](/capsicum_helpers/3.md), [libcasper(3)](/libcasper/3.md), [procdesc(4)](/procdesc/4.md)

## HISTORY

**Capsicum** first appeared in FreeBSD 9.0, and was developed at the University of Cambridge.

## AUTHORS

**Capsicum** was developed by Robert Watson ⟨*rwatson@FreeBSD.org*⟩ and Jonathan Anderson ⟨*jonathan@FreeBSD.org*⟩ at the University of Cambridge, and Ben Laurie ⟨*benl@FreeBSD.org*⟩ and Kris Kennaway ⟨*kris@FreeBSD.org*⟩ at Google, Inc., and Pawel Jakub Dawidek ⟨*pawel@dawidek.net*⟩. 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.
