CL-0011: cap_add: NET_ADMIN, BPF, SYS_BOOT¶
Severity: HIGH (how it is derived)
The service adds NET_ADMIN, BPF or SYS_BOOT, each of which reaches other
containers or the host. Remove it unless managing interfaces, loading BPF
programs or rebooting the host is the service's job, and then keep it as the
only capability the service holds.
Fix¶
A common case is a VPN container set up from a kernel-mode example. Tailscale's image runs in userspace networking mode by default, which needs no capability at all:
# Before
services:
tailscale:
image: tailscale/tailscale:v1.104.1
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
environment:
TS_USERSPACE: "false"
# After: userspace networking, the image's default
services:
tailscale:
image: tailscale/tailscale:v1.104.1
cap_drop:
- ALL
- Remove the capability and see whether the service still does its job.
This is the drop-and-observe loop on CL-0006. Read the
logs, not only the container state: Tailscale in kernel mode without
NET_ADMINstaysrunningwhile its daemon has failed with
wgengine.NewUserspaceEngine(tun "tailscale0") error: tstun.New("tailscale0"): operation not permitted
(captured on Docker 29.7.2, not CI-asserted).
A missing NET_ADMIN elsewhere usually reads
ip: RTNETLINK answers: Operation not permitted.
-
Prefer a mode that does not need it. In Tailscale's userspace mode there is no
tailscale0interface; other processes reach the tailnet through the daemon's SOCKS5 or HTTP proxy (Tailscale: userspace networking). Undercap_drop: [ALL]it logs two warnings about UDP buffer sizes, markedimpacts throughput only, and atstunline about tun device stats; all three appear at default capabilities too, so none is caused by the drop. -
If the capability is genuinely needed, make it the only one, and record why. A kernel-mode VPN or a router container needs
NET_ADMINto manage its interface and routes:
services:
vpn:
image: tailscale/tailscale:v1.104.1
cap_drop:
- ALL
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
environment:
TS_USERSPACE: "false"
# .compose-lint.yml
rules:
CL-0011:
exclude_services:
vpn: "kernel-mode WireGuard interface needs NET_ADMIN; reviewed 2026-10"
NET_ADMIN reaches the containers on the networks this service joins, so
keep it off networks it has no reason to share.
- Check what the container holds.
CapBndin/proc/1/statusis the most any process in the container can hold (CL-0006 explains reading it):
docker compose exec vpn grep CapBnd /proc/1/status
# CapBnd: 0000000000001000
capsh --decode=0000000000001000 # on the host, from libcap
# 0x0000000000001000=cap_net_admin
- Check the finding:
compose-lint -q compose.yaml | grep CL-0011
It prints nothing once the capability is gone. A suppressed service still
prints its line, marked SUPPRESSED, with your reason in the full output.
Verified against Docker 29.7.2 and tailscale/tailscale:v1.104.1: userspace
mode starts under cap_drop: [ALL]; kernel mode fails without NET_ADMIN and
starts with it as the only capability.
BPF and SYS_BOOT have no common no-capability alternative: a tool that loads
BPF programs or reboots the host needs them, which is reason to ask whether
that tool belongs in a container. Keep them as the only capability and suppress
the same way.
Tested on: Docker 29.7.2 with Compose 5.5.0, on a host without AppArmor (Yama ptrace_scope 1); the Fix steps above were re-run there in October 2026. Also measured in throwaway VMs in October 2026 (Docker 29.9.1 or 29.1.3): on Ubuntu 24.04 with AppArmor, kexec_load with SYS_BOOT returned Operation not permitted under the default seccomp profile and succeeded only with seccomp unconfined. Not tested: SELinux.
What it detects¶
cap_add entries naming a capability that reaches past this container without
handing over host code execution outright:
| Capability | Grants |
|---|---|
NET_ADMIN |
reconfigure interfaces, routes and firewall rules — transparent interception of other containers' traffic, which NET_RAW alone cannot reach |
BPF |
load BPF programs — kernel introspection and manipulation, and a recurring container-escape surface |
SYS_BOOT |
reboot or power off the host via reboot(2). It does not load a kernel via kexec: kexec_load(2) returns EPERM even with the capability held (verified on Docker 29.1.3) — the default seccomp profile blocks it outright rather than gating it on a capability |
CAP_-prefixed and lowercase spellings are matched the same way: Docker treats
CAP_NET_ADMIN and NET_ADMIN as the same capability.
This rule is one of six over cap_add, split by what the capability
grants, because SARIF advertises security-severity on the rule descriptor and
a rule carrying two severities misreports one of them:
| Rule | Tier | Members |
|---|---|---|
| CL-0024 | CRITICAL | ALL, SYS_ADMIN, SYS_MODULE, SYS_RAWIO |
| CL-0011 | HIGH | NET_ADMIN, BPF, SYS_BOOT |
| CL-0028 | HIGH | SYS_TIME, PERFMON |
| CL-0029 | HIGH | SYS_NICE, IPC_LOCK, LEASE |
| CL-0030 | HIGH | SYSLOG |
| CL-0027 | MEDIUM | SYS_PTRACE, DAC_READ_SEARCH |
Safe capabilities such as NET_BIND_SERVICE and CHOWN are not flagged by any
of the six. Neither are MKNOD, SYS_CHROOT and DAC_OVERRIDE: all three
are in Docker's default set, so flagging them on cap_add scored the
declaration rather than the runtime state, and inverted the gate —
cap_drop: [ALL] plus cap_add: [DAC_OVERRIDE] (one capability) failed at the
default --fail-on high, while no cap_drop at all (fourteen capabilities,
DAC_OVERRIDE among them) passed (issue #492).
Why it matters¶
Linux capabilities split root's privileges into discrete units, and these three are the ones that reach other containers or the host without being an escape on their own.
NET_ADMIN is the one to understand first, because it is the capability people
add casually for VPN and networking containers. It is strictly more than
NET_RAW (CL-0006): NET_RAW buys interception and denial of
service against an L2 neighbour, while NET_ADMIN adds the routing and
ip_forward control needed for a transparent man-in-the-middle that the
victim cannot detect from its own connectivity.
BPF is a kernel read/write primitive on modern kernels and a recurring escape
surface. SYS_BOOT is availability only — but host availability, which no other
rule in the set reaches.
ATT&CK coverage¶
Remediating this finding contributes to mitigating the following MITRE ATT&CK techniques (pinned to ATT&CK v18). compose-lint is a static analyser, so this is mitigation coverage — it detects nothing at runtime.
| Technique | Tactic |
|---|---|
| T1611 Escape to Host | Privilege Escalation |
| T1557 Adversary-in-the-Middle | Credential Access (Enterprise/Linux, not on the Containers matrix) |
| T1040 Network Sniffing | Credential Access (Enterprise/Linux, not on the Containers matrix) |
| T1529 System Shutdown/Reboot | Impact |
See also¶
- CL-0002 —
privileged: true(functional superset ofcap_add: ALL) - CL-0006 —
cap_drop: [ALL]baseline (drops the defaults this rule'scap_addre-grants) - Hardening guide, step 5 — where this rule fits when hardening a whole file
Severity derivation¶
Derivation (see severity model):
- Baseline: A — the attacker already has code execution in this container, as the workload uid
- Precondition: Technique — each member is a primitive that needs a published technique to become impact: ARP or route manipulation for
NET_ADMIN, a BPF-based kernel attack, a reboot as a denial of service - Impact: Cross-container — traffic interception across containers on the host, kernel manipulation shared by all of them, or host availability
- Qualifier/modifier: none
- Derived: Technique × Cross-container = HIGH
- Shipped: HIGH
- Evidence:
_cl0011proves only thatcap_adddeposits the capability into the effective set — it does not exercise any member's reach. The cross-container impact (NET_ADMINtraffic manipulation on a shared Docker network,BPFkernel access) is reasoned from the capabilities' semantics under Docker's default seccomp profile;_t_net_admincovers only an in-netns route change, not cross-container interception. One member claim is empirically pinned:SYS_BOOT's kexec story is refuted, not assumed —kexec_loadreturns EPERM even with the capability held (captured on Docker 29.1.3), so the documented grant isreboot(2)
References: - OWASP Docker Security Rule #3 - CIS Docker Benchmark 5.4 — Ensure that Linux kernel capabilities are restricted within containers
A reference means the rule relates to that source. It does not mean a file with no finding complies with it. The CIS, OWASP and ATT&CK mapping for every rule, and the tags SARIF output carries for it, are on Standards mapping.