Skip to main content

Am I in a Container?

Enumeration

Capabilities determine what the container is allowed to do. A long list or cap_sys_admin means you have serious power.
Privileged containers have all capabilities, seccomp disabled, and full access to host devices.
Docker’s default bridge puts containers on 172.17.0.0/16. Other containers are often reachable here.
Mounted volumes, bind mounts, and Docker secrets are common paths to host access or credentials.

Breakout Scenarios

Being in the docker group is effectively root. Mount the host filesystem into a container and chroot in.
Alternative: create a SUID bash binary via the mounted filesystem, then execute it on the host.
If /var/run/docker.sock is writable, you can talk to the daemon directly without being in the docker group.
Privileged containers have all capabilities and can see host block devices. Mount the host drive and write to it directly.
A non-privileged container with CAP_SYS_ADMIN and no AppArmor profile can abuse cgroup release agents to execute commands on the host.
Catch the shell on the attacker:
If sudo -l shows (root) NOPASSWD: /usr/bin/docker exec *, you can exec into any running container as root.