Skip to content

Lesson 5 of 14 · 13m

Seccomp: The Syscall Gate

The default seccomp profile is an allowlist that denies roughly 44 dangerous syscalls, and blocking io_uring in 2021 erased dozens of CVEs' worth of surface.

Every escape ends at a syscall

Strip away the tooling and a container escape is a process making syscalls the kernel shouldn't have honored. Mount the host disk — mount(2). Write the cgroup release agent — open, write. Load a module — init_module. Enter another namespace — setns. Seccomp is the layer that says which of the kernel's 400-plus syscalls a process may call at all, and Docker runs every container behind a BPF filter doing exactly that.

The default profile lives in moby's profiles/seccomp/seccomp_default.go. It's an allowlist: roughly 300 calls permitted, the dangerous remainder denied with SCMP_ACT_ERRNO. Docker's own documentation summarizes it as blocking around 44 syscalls out of the 300-plus available — mount, umount2, pivot_root, kexec_load, init_module, finit_module, delete_module, bpf, keyctl, add_key, request_key, perf_event_open, userfaultfd, ptrace, process_vm_readv, process_vm_writev, open_by_handle_at, the new-mount-API family (fsopen, fsconfig, fsmount, move_mount), reboot, swapon, swapoff, and the whole io_uring_* family.

Some entries are conditional on capabilities — the profile grants CAP_SYS_ADMIN-holders a wider syscall set, which is another reason that capability is the hinge everything hangs on.

The io_uring story is the point

io_uring is the async I/O interface added in kernel 5.1. It is also three syscalls (io_uring_setup, io_uring_register, io_uring_enter) fronting an enormous kernel surface — registered buffers, polled rings, request types covering everything from openat to splice — and it became the most productive bug farm the kernel had grown in years. Google reported in June 2023 that io_uring accounted for about 60% of the Linux kernel vulnerabilities submitted to its kCTF exploit bounty the year before, and disabled it in production builds of Android, ChromeOS, and gVisor.

Docker had already moved: release 20.10.9 in October 2021 added all three io_uring syscalls to the default seccomp denylist. That is seccomp working as designed — you cannot fix a kernel bug you haven't heard of yet, but you can decide the container doesn't get to reach the buggy subsystem. Blocking three syscalls erased an attack surface measured in dozens of CVEs.

Where seccomp can't save you

Keep the model honest. Seccomp is a syscall gate, not a bug fix. Dirty Pipe (CVE-2022-0847) walked in through splice(2) — a syscall the profile must allow because ordinary file copying uses it — and wrote to the page cache of read-only files. No filter distinguishes "legitimate splice" from "splice that corrupts runc's binary." The gate shrinks surface; it does not audit semantics. Syscalls are the wrong granularity for intent.

Custom profiles exist for the workloads that need them: a JSON allowlist (same shape as the default), applied per container:

docker run --security-opt seccomp=/path/to/profile.json app

Kubernetes exposes it as securityContext.seccompProfile.type: RuntimeDefault (the runtime's built-in profile — what you want), Localhost (a profile you ship to the node), or Unconfined (the gate removed entirely). There is also --security-opt seccomp=unconfined on the Docker side, which people reach for when a profile "breaks the app." The right fix is to find the denied syscall — the filter logs denials via SCMP_ACT_LOG, or the app dies with EPERM you can trace — and write a profile that allows exactly it.

What to actually do

Also worth knowing: no_new_privs is not seccomp — it is a per-process flag (PR_SET_NO_NEW_PRIVS) that stops privilege gain through setuid/file-capability execs, and it composes with seccomp rather than replacing it. Docker exposes it as --security-opt=no-new-privileges:true; Kubernetes as allowPrivilegeEscalation: false. The two controls overlap only in spirit: one gates syscalls, the other gates privilege accumulation.

The defaults are the control. Keep RuntimeDefault seccomp on every pod, never deploy seccomp=unconfined or Unconfined for anything semi-trusted, and treat --privileged (which disables seccomp along with AppArmor and SELinux) as equivalent to unconfined. When a workload needs a wider gate, write the narrowest custom profile that compiles — every syscall you re-add is attack surface you chose on purpose.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.