CL-0009: seccomp:unconfined / apparmor:unconfined — disabled syscall and MAC profiles¶
Severity: HIGH (how it is derived)
The service turns off Docker's default seccomp filter, its AppArmor profile, or SELinux labelling, so the container reaches the kernel without the guard every other container has. Remove the disable; if the default filter blocks something the service needs, allow just that in a custom profile.
Fix¶
Remove the entry; Docker's defaults apply automatically:
# Before
services:
web:
image: nginx:1.27-alpine
security_opt:
- no-new-privileges:true
- seccomp:unconfined
# After
services:
web:
image: nginx:1.27-alpine
security_opt:
- no-new-privileges:true
compose-lint fix deletes the entry when another security_opt entry stays
behind, as no-new-privileges:true does here, and warns first that the default
profile may block a call the service makes. When the disable is the service's
only entry, it lists the line for you to edit instead:
compose-lint fix --only CL-0009 compose.yaml # show the diff
compose-lint fix --only CL-0009 --apply compose.yaml # write it
- Recreate the service and check the filter is on. The kernel reports the
seccomp mode in
/proc/<pid>/status:2is a filter,0is none:
docker compose up -d web
docker compose exec web grep Seccomp: /proc/1/status
# Seccomp: 2 (0 under seccomp:unconfined)
On an AppArmor host, docker compose exec web cat /proc/1/attr/current
prints docker-default (enforce). On a host without AppArmor the same
command fails with cat: read error: Invalid argument (captured on Docker
29.7.2, not CI-asserted); that is expected, not a misconfiguration.
-
Exercise the service and read its logs. A call the default filter blocks fails with
Operation not permitted, as a missing capability does; read it the way CL-0006 describes. -
If one call is genuinely needed, allow only that one. Start from the profile your Docker version ships, add a rule, and point the service at the copy. For example, a sandbox that creates user namespaces needs
unshare, which the default profile allows only withSYS_ADMIN:
# Download the default profile that matches your Docker Engine. This path
# exists for Docker 29 release tags; for an older or distribution-patched
# engine, take profiles/seccomp/default.json from moby at your version's tag.
v=$(docker version --format '{{.Server.Version}}')
curl -fsSLo default.json \
"https://raw.githubusercontent.com/moby/moby/docker-v$v/vendor/github.com/moby/profiles/seccomp/default.json"
# Add one rule that allows unshare unconditionally
jq '.syscalls += [{"names": ["unshare"], "action": "SCMP_ACT_ALLOW"}]' default.json > seccomp.json
services:
sandbox:
image: busybox:1.37
command: ["unshare", "-U", "-r", "id", "-u"]
security_opt:
- seccomp:./seccomp.json # relative to the Compose file
Under the default profile that command fails with
unshare: unshare(0x10000000): Operation not permitted (busybox,
re-proven on every CI run by scripts/validate_rule_premises.py); under the custom one it prints 0, and Seccomp: still reads 2. Allowing unshare opens
user namespaces, a real widening of what the container can reach in the
kernel, but a far smaller one than seccomp:unconfined, which allows
every call. A custom profile is not flagged by this rule.
On some AppArmor hosts this example needs more than seccomp. There,
Docker's docker-default AppArmor profile refuses user-namespace creation
on its own, so the same command under the custom seccomp profile still fails,
now with unshare: unshare(0x10000000): Permission denied, and the host's
kernel log records apparmor="DENIED" operation="userns_create"
profile="docker-default" (both captured on Docker 29.1.3, Debian 13 with
AppArmor, not CI-asserted). Ubuntu 24.04 (kernel 6.8) did not refuse it:
with Docker 29.9.1 and 29.1.3 alike the custom-profile command printed 0,
so whether docker-default mediates user namespaces depends on the host's
AppArmor, not on the Docker version. Where it refuses, it works only once
AppArmor is unconfined too,
which this rule flags. On such a host a sandbox that needs user namespaces
needs a custom AppArmor profile as well as the seccomp one; SYS_ADMIN does
not get past docker-default either. Check which you have with
cat /sys/module/apparmor/parameters/enabled (Y means AppArmor).
- Check the finding is gone:
compose-lint -q compose.yaml | grep CL-0009 # prints nothing once fixed
Verified against Docker 29.7.2 on a host without AppArmor, and against Docker
29.1.3 on Debian 13 with AppArmor enforcing, where a default container reports
docker-default (enforce) and the user-namespace refusal above was measured.
On Fedora 43 with SELinux enforcing (labelling enabled in the daemon, which
Docker CE leaves off by default), a default container runs as container_t
and label:disable switches it to spc_t. Other LSMs were not tested.
When to suppress¶
- A debugger or tracer that genuinely needs
ptraceof arbitrary syscalls — narrow to a custom profile if at all possible, and never run it on a production network. - Sandboxes that need to run their own seccomp profile (browsers, language runtimes) —
seccomp:unconfinedis sometimes the documented way to let the inner sandbox install its filter. Suppress only when verified.
What it detects¶
Any service with seccomp:unconfined, apparmor:unconfined, or label:disable in security_opt that is still in effect when the container starts.
Docker applies security_opt in order. For seccomp and apparmor each entry replaces the profile before it, so the last entry for the key is the one the container runs with: [seccomp:unconfined, seccomp:builtin] is filtered and is not flagged, and the reverse order is. When the last entry is a disable, every disable for that key is flagged, because removing only the last would promote the one before it. label options are different: they accumulate, and disable anywhere among them turns SELinux labelling off, so every label:disable is flagged wherever it sits.
This rule only flags explicitly disabled profiles. Services that omit security_opt entirely are not flagged — the host applies default profiles automatically. Custom profiles (e.g., seccomp:custom.json) and SELinux label overrides that don't disable confinement (e.g., label:user:system_u) are also not flagged. SELinux label:type:spc_t (super-privileged container) is functionally similar to label:disable but is currently out of scope for this rule — it requires SELinux-specific knowledge of type transitions to evaluate. No corpus file uses it; it is recorded as a candidate row for the security_opt spelling table (#1022).
Two other security_opt values weaken confinement and are not graded by any rule: systempaths=unconfined (removes Docker's masks over /proc/sysrq-trigger, /proc/kcore and /proc/sys) and writable-cgroups=true (mounts /sys/fs/cgroup read-write). That is a demand decision, not a judgement that they are harmless: the corpus has one service using the first, already flagged CRITICAL by CL-0024, and none using the second (Triage for a newly found gap in ASSURANCE.md). The measurements, including the /proc write path that only AppArmor blocks, are in #993; it is recounted at each corpus refresh.
Why it matters¶
Linux distributions apply security profiles by default:
-
seccomp: Docker's default profile (
seccomp/default.jsoninmoby/profiles) blocks dozens of syscalls outright and gates many more behind a specific capability. Disabling it gives the container the kernel's full unrestricted syscall surface — a massively expanded attack surface for kernel exploits.The gate is mostly capability-shaped rather than absolute, which matters when reasoning about what the profile is actually protecting. At default capabilities
bpf(2)andinit_module(2)both return EPERM; addBPForSYS_MODULEand the same calls reach the kernel and fail on their arguments instead — EINVAL and ENOEXEC respectively (verified on Docker 29.1.3). So the default profile is not what stands between a container and those syscalls; the capability set is, and dropping capabilities (CL-0006) is the control that closes them.kexec_load(2)is the counter-example that stays shut: it returns EPERM even withSYS_BOOTheld. - AppArmor: Docker's default profile (docker-default) restricts file paths in/procand/sys, blocks ptrace of host processes, and deny-lists/proc/kcoreand similar. Disabling it removes those mandatory access controls beyond what capabilities alone enforce. - SELinux: On RHEL-family hosts, applies type enforcement via labels (container_t) that confine what files and processes a container can access.label:disableturns off type-enforcement confinement for the container; the container then runs in the calling user's domain, which on a typical container host isunconfined_t.
Explicitly disabling any of these is an intentional weakening of container isolation that should only be done with strong justification.
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 |
|---|---|
| T1685 Disable or Modify Tools | Defense Impairment |
See also¶
- CL-0002 —
privileged: true(drops the default seccomp and AppArmor profiles) - CL-0003 —
no-new-privileges:true(blocks privilege gain atexecve; seccomp and the LSM profile stay attached either way) - Hardening guide, step 4 — 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: Second flaw — removing the syscall filter and the LSM profile grants nothing on its own. It widens the kernel attack surface, and landing an escape still needs a kernel defect
- Impact: Cross-container — the exposed surface is the kernel, shared by every container on the host
- Qualifier/modifier: none
- Derived: Second flaw × Cross-container = HIGH
- Shipped: HIGH
- Evidence:
_cl0009(a seccomp filter is active by default). The gate is capability-shaped rather than absolute: at default capabilitiesbpf(2)andinit_module(2)return EPERM, and with the matching capability added they reach the kernel and fail on their arguments instead (EINVAL, ENOEXEC) — verified live on Docker 29.1.3
References: - OWASP Docker Security Rule #6 - CIS Docker Benchmark 5.22 — Ensure the default seccomp profile is not Disabled - CIS Docker Benchmark 5.2 — Ensure that, if applicable, an AppArmor Profile is enabled - CIS Docker Benchmark 5.3 — Ensure that, if applicable, SELinux security options are set
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.