Join our Newsletter — 33% off our NHI Course
Home› Guides› seccomp Guide: Syscall Filtering for Services and Containers
Guide Endpoint Security

seccomp Guide: Syscall Filtering for Services and Containers

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 13 min read
On this page

Every process on Linux can call into hundreds of kernel system calls, and most kernel privilege escalation and container escape bugs are reached through calls the workload never needed. seccomp (secure computing mode) lets a process, or the service manager or container runtime that starts it, install a filter that allows, denies, logs or kills on individual system calls. It is one of the cheapest ways to shrink the kernel attack surface, yet many Kubernetes clusters still run pods unconfined and most systemd services ship with no filter at all. This guide explains how seccomp filters work, what they do and do not protect, how to apply them to systemd services, Docker and Kubernetes, how to build custom profiles safely, and how to monitor them. It is for Linux platform engineers, container platform teams and detection engineers.

Key takeaways

  • seccomp reduces kernel attack surface; it is not a sandbox on its own. The kernel documentation says so directly. Combine it with capabilities, namespaces and an LSM such as SELinux or AppArmor.
  • Turn on the runtime default everywhere first: Docker applies a default profile, but Kubernetes pods are unconfined unless a profile is set or the kubelet's seccomp default is enabled.
  • Privileged containers ignore seccomp: a pod with privileged: true always runs unconfined, so policy must block privileged pods as well.
  • Use systemd's syscall groups for services: SystemCallFilter=@system-service with SystemCallArchitectures=native is a practical starting point for most daemons.
  • Build custom profiles in log mode first, then enforce, and treat profile changes as code with tests, because a missing syscall breaks the workload.

What seccomp is and what it is not

Linux has two seccomp modes. Strict mode (SECCOMP_SET_MODE_STRICT) allows only read, write, _exit and sigreturn, and is rarely useful outside special cases. Filter mode (SECCOMP_SET_MODE_FILTER, often called seccomp-bpf) loads a classic BPF program that inspects each system call's number, architecture and register arguments and returns an action. Filter mode is what Docker, containerd, CRI-O, systemd, browsers and many daemons use.

  • Who can install a filter: a process must have set no_new_privs or hold CAP_SYS_ADMIN in its user namespace; otherwise the call fails with EACCES. This stops an unprivileged user from filtering a setuid program into misbehaving.
  • Inheritance: if the filter allows fork, clone and execve, children and executed programs stay under the same filter. More filters can be stacked; the most restrictive action wins.
  • Arguments only, not memory: BPF filters can test register values but cannot dereference pointers. A filter can block clone with namespace flags, but it cannot inspect a path string passed to open. File access policy belongs to an LSM.
  • Architecture matters: system call numbers differ between ABIs (for example x86-64, x32 and i386). A filter that does not check the architecture can be bypassed by calling through another ABI. The kernel documentation names this as the most common pitfall.
  • Not a policy engine: the kernel documentation states that system call filtering "isn't a sandbox". It removes kernel entry points; it does not decide which files, networks or users a process may reach.

Filter actions

Action (highest precedence first)EffectTypical use
SECCOMP_RET_KILL_PROCESSWhole process exits with SIGSYSHard deny for calls that should never happen
SECCOMP_RET_KILL_THREADCalling thread exitsLegacy default kill behaviour
SECCOMP_RET_TRAPSIGSYS delivered to the task, call not runApplications that handle the signal themselves
SECCOMP_RET_ERRNOCall skipped, error returned (for example EPERM)Container runtime defaults; gentle failure
SECCOMP_RET_USER_NOTIFCall forwarded to a user-space supervisorRuntimes that emulate selected calls; supervisor must avoid time-of-check races
SECCOMP_RET_TRACEptrace tracer notifiedDebugging and tracing tools
SECCOMP_RET_LOGCall runs and is loggedProfile development and audit mode
SECCOMP_RET_ALLOWCall runsAllowed calls

Logging of actions is controlled by /proc/sys/kernel/seccomp/actions_logged; SECCOMP_RET_LOG events appear only if log is listed there, and ALLOW actions can never be logged.

Where seccomp profiles come from

LayerHow it is setDefault behaviourNotes
Docker EngineDefault profile; --security-opt seccomp=profile.json for customAllowlist with defaultAction SCMP_ACT_ERRNO; disables around 44 of 300+ callsDocker documents that changing the default is not recommended
KubernetessecurityContext.seccompProfile.type: RuntimeDefault, Localhost or UnconfinedUnconfined unless set, or unless the kubelet runs with --seccomp-defaultRuntimeDefault differs between containerd and CRI-O and between versions
systemd servicesSystemCallFilter=, SystemCallArchitectures=, SystemCallErrorNumber=, SystemCallLog=No filter unless the unit sets oneMany distribution units already set filters; check with systemd-analyze security
Applicationslibseccomp or raw seccomp(2) in the programDepends on the softwareBrowsers, OpenSSH's privilege-separated child and many sandboxed daemons do this themselves

What the Docker default profile blocks

The Docker default profile is an allowlist. Calls that are not listed return an error, and several are allowed only when the container has been given the matching capability. Examples from Docker's documentation and the published profile:

  • Kernel modules and kexec: init_module, finit_module, delete_module, kexec_load, kexec_file_load.
  • Namespace and mount operations: mount, unshare, setns and clone with namespace flags are allowed only when the container has CAP_SYS_ADMIN. This matters because many kernel privilege escalation exploits start by creating a user namespace to gain capabilities inside it.
  • Kernel keyring: add_key and keyctl, because the keyring is not namespaced.
  • Clock changes: clock_settime and clock_adjtime, because time is not namespaced.
  • io_uring: io_uring_setup, io_uring_enter and io_uring_register, which Docker blocks citing known container escape vulnerabilities.
  • Tracing and BPF: bpf and perf_event_open; bpf is allowed only with CAP_SYS_ADMIN or CAP_BPF.

Granting capabilities therefore loosens the effective seccomp profile. A container given CAP_SYS_ADMIN regains mount, unshare and namespace calls. See the Linux Capabilities Guide.

seccomp for systemd services

systemd exposes seccomp through unit file settings, which makes it the easiest way to filter host daemons without changing their code. SystemCallFilter= takes system call names or predefined groups. Without a leading ~ it is an allowlist; with ~ it is a denylist. By default a denied call kills the process with SIGSYS; SystemCallErrorNumber=EPERM makes it fail with an error instead.

GroupContentsTypical decision
@system-serviceCalls typically needed by system services, excluding special-purpose groups such as @clock, @mount, @swap and @rebootRecommended allowlist starting point
@privilegedAll calls that need superuser capabilitiesDeny for services that run as non-root
@resourcesChanging resource limits, memory and scheduling parametersDeny unless the service tunes itself
@mountMounting, unmounting and chrootDeny; also protects ReadOnlyPaths= from being undone
@module, @reboot, @swap, @clock, @raw-ioKernel modules, reboot and kexec, swap, clock changes, raw I/O portsDeny for almost every service
@debug, @cpu-emulation, @obsoleteptrace and perf, vm86, obsolete callsDeny

A typical hardened unit drop-in:

[Service]
NoNewPrivileges=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallErrorNumber=EPERM
  • Block other ABIs: systemd's documentation recommends SystemCallArchitectures=native alongside any filter so that alternative ABIs cannot be used to get round it.
  • Know the implicit allowances: execve, exit, exit_group, rt_sigreturn and time queries are always allowed, so the service can start.
  • Check group contents for your version: systemd-analyze syscall-filter @system-service lists what a group contains on this host. Group contents change between systemd versions.
  • Score your services: systemd-analyze security gives each service an exposure estimate from 0.0 to 10.0 based on the sandboxing settings in use, with higher meaning less sandboxed. It only considers systemd settings, not protections inside the program.
  • Audit before enforcing: SystemCallLog= logs listed calls (or all except listed with ~) without blocking, which helps find what a service uses.

The Linux Server Hardening Guide covers the other systemd sandboxing settings that pair with these.

seccomp in containers and Kubernetes

  • Set a profile on every pod: use seccompProfile.type: RuntimeDefault at pod level in spec.securityContext so all containers inherit it, including init and ephemeral containers. Container-level settings override the pod value.
  • Make RuntimeDefault the node default: run the kubelet with --seccomp-default (or the equivalent kubelet configuration setting) on each node, so pods without a profile get RuntimeDefault instead of running unconfined. This is stable from Kubernetes v1.27.
  • Enforce with Pod Security Admission: the Pod Security Standards Baseline level forbids explicitly setting Unconfined; the Restricted level requires RuntimeDefault or Localhost and prohibits an absent profile. See the Kubernetes Admission Control Guide.
  • Block privileged pods: seccomp cannot be applied to a container with privileged: true, which always runs unconfined. Baseline and Restricted both disallow privileged pods.
  • Custom profiles: Localhost profiles are JSON files on each node under the kubelet seccomp directory (/var/lib/kubelet/seccomp on Linux). If the file is missing, the container fails with CreateContainerError, so distribute profiles to every node before referencing them, typically with a DaemonSet or an operator.
  • Know runtime differences: Kubernetes warns that RuntimeDefault profiles differ between runtimes and versions, and that some actions such as SCMP_ACT_NOTIFY are not supported everywhere. Test on the runtime you run.

Container escape (MITRE ATT&CK T1611 Escape to Host) and kernel exploitation for privilege escalation (T1068) are the threats seccomp most directly reduces. The Container Security Guide and Container Runtime Security Guide place it alongside the other runtime controls.

Choosing a profile strategy

StrategyEffortProtectionBreakage riskChoose when
Runtime default (RuntimeDefault, Docker default)LowBlocks the most dangerous callsLow; occasional issues with tools needing namespaces or io_uringAlways, as the floor for every container
systemd groups (@system-service plus denies)Low to mediumGood for host daemonsMedium; test each unitHost services you package or configure
Denylist of specific callsLowLimited; new calls are allowed by defaultLowQuick mitigation for a specific kernel bug
Recorded custom allowlistHighStrongest; only observed calls allowedHigh if recording missed rare pathsHigh-value, stable workloads; internet-facing parsers

Small teams should stop at runtime default plus systemd groups and spend the effort on blocking privileged containers and dropping capabilities. Large platforms with stable, high-risk services can justify recorded allowlists, managed as code with an owner per profile.

Building and rolling out custom profiles

  1. Baseline: enable RuntimeDefault for all pods and the kubelet seccomp default on a pilot node pool; measure failures.
  2. Record: for a workload that needs a tighter profile, run it under a profile with defaultAction SCMP_ACT_LOG (containers) or SystemCallLog= (services) through a full test cycle, including start-up, error paths, backups and shutdown.
  3. Generate: build an allowlist from the logged calls, set defaultAction to SCMP_ACT_ERRNO, and include the architecture map for every architecture you run.
  4. Test in CI: run integration tests against the enforced profile; fail the pipeline if the workload breaks.
  5. Canary: deploy to a small share of replicas with alerting on SIGSYS terminations and EPERM spikes.
  6. Enforce and own: roll out fully, store the profile next to the workload's code with a named owner, and regenerate when the base image or runtime changes.
  7. Roll back: revert to RuntimeDefault, not to Unconfined, if a custom profile breaks production.

Detection and measurement

  • Kernel audit records: seccomp log and kill events appear as audit records (type SECCOMP) with the syscall number, architecture and process. Collect them through auditd or journald and translate syscall numbers per architecture.
  • Kill and error spikes: a sudden rise in SIGSYS kills or denied calls from one workload can indicate an exploit attempt (for example a process trying unshare or keyctl) or a broken deployment. Both deserve a look.
  • Policy drift: alert on pods created with Unconfined, with privileged: true, or with added SYS_ADMIN, using admission logs and the Kubernetes audit log. See the Kubernetes Audit Log Detection Guide.
  • Process status: the Seccomp field in /proc/<pid>/status shows whether a running process is filtered, which lets you audit hosts for unfiltered daemons.

Metrics: percentage of running pods with RuntimeDefault or Localhost profiles (target 100 per cent outside documented exceptions); number of privileged pods in production; percentage of nodes with the kubelet seccomp default enabled; median systemd-analyze security exposure score for internet-facing services; and number of custom profiles without an owner or older than the workload's current image.

Common failure patterns

  • Assuming Kubernetes applies the runtime default: pods without a profile run unconfined unless the kubelet default is turned on, even though the same image under Docker would be filtered.
  • Privileged pods as a shortcut: setting privileged: true to fix a permissions error removes seccomp, capabilities limits and device restrictions in one step.
  • Setting Unconfined to fix one tool: a debugging or monitoring agent needs one call, and the whole profile is removed rather than adjusted.
  • Denylists that forget other ABIs: a filter that blocks a call by its x86-64 number but not its i386 or x32 number, without an architecture check.
  • Recorded profiles that miss rare paths: the allowlist was recorded during happy-path tests, and the service dies during log rotation or failover.
  • Treating seccomp as the whole sandbox: a filtered process running as root with broad capabilities and no LSM confinement can still read and change everything its calls permit.

Framework mapping

FrameworkReferenceHow seccomp contributes
NIST SP 800-53 Rev. 5SC-39 Process Isolation; CM-7 Least Functionality; CM-6 Configuration SettingsRestricts the kernel functions a process can use; profiles are configuration settings to baseline
NIST CSF 2.0PR.PS-01Profiles applied and maintained as part of configuration management
MITRE D3FENDD3-SCF System Call FilteringThe defensive technique seccomp implements
MITRE ATT&CKT1611 Escape to Host; T1068 Exploitation for Privilege EscalationRemoves kernel entry points used in escapes and local exploits
Kubernetes Pod Security StandardsBaseline and Restricted seccomp controlsAdmission-time enforcement of profiles
NIST SP 800-190Container runtime and host OS countermeasuresSee the NIST SP 800-190 Container Security Guide

Practitioner checklist

  • Enable the kubelet seccomp default on every node and set RuntimeDefault at pod level in workload templates.
  • Enforce Pod Security Standards Restricted (or at least Baseline) so Unconfined and privileged pods are rejected.
  • Do not grant CAP_SYS_ADMIN to containers; it re-enables mount, unshare and namespace calls in the default profile.
  • Add NoNewPrivileges, SystemCallArchitectures=native and SystemCallFilter=@system-service to host service units, tested per unit.
  • Run systemd-analyze security on servers and work down the highest exposure scores for internet-facing services.
  • Build custom allowlists in log mode first, test them in CI and canary them before enforcing.
  • Store every custom profile with its workload, with an owner and a review trigger when the image or runtime changes.
  • Collect seccomp audit records and alert on kill and denial spikes and on pods created unconfined.

Standards and references

Related NHI Mgmt Group resources: Container Security Guide · Linux Capabilities Guide · Linux Namespaces and cgroups Security Guide · Kubernetes Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.