Severity: CRITICAL · Rule ID: compose-sensitive-host-mount
A service bind-mounts /, /etc, /root, /var/run, /proc, or /sys.
services:
backup:
image: alpine
volumes:
- /:/host # <- the entire host filesystem, writableMounting a sensitive host path hands the container the contents of the host. /etc exposes
shadow, SSH host keys, and every service credential on the box. / writable means the container
can modify systemd units or authorized_keys and take over the host at the next boot or login.
/proc and /sys expose kernel interfaces that can be used to affect the host directly.
Mount the narrowest path that works, read-only where possible:
services:
backup:
image: alpine
volumes:
- /srv/appdata:/data:ro # one directory, read-onlyBackup and monitoring agents sometimes need broad read access. Use :ro, scope to the
specific subtree, and never mount / writable.
Permanently, for the whole repository:
# .docksec.yml
rules:
disabled:
- compose-sensitive-host-mountOr per finding, with a reason and an expiry that keeps the decision auditable:
# .docksec-ignore.yml
ignores:
- id: compose-sensitive-host-mount
reason: "why this is accepted here"
expires: 2027-01-01- Implementation:
docksec/compose_scanner.py - All compose rules · Exploit chains