Am I in a Container?
Enumeration
Identity and User Context
Identity and User Context
Capabilities
Capabilities
Capabilities determine what the container is allowed to do. A long list or
cap_sys_admin means you have serious power.Privileged Container Check
Privileged Container Check
Privileged containers have all capabilities, seccomp disabled, and full access to host devices.
Network and Neighbors
Network and Neighbors
Docker’s default bridge puts containers on
172.17.0.0/16. Other containers are often reachable here.Mounts and Secrets
Mounts and Secrets
Mounted volumes, bind mounts, and Docker secrets are common paths to host access or credentials.
From the Host (docker group or socket access)
From the Host (docker group or socket access)
Breakout Scenarios
Docker Group Membership
Docker Group Membership
Being in the Alternative: create a SUID bash binary via the mounted filesystem, then execute it on the host.
docker group is effectively root. Mount the host filesystem into a container and chroot in.Writable Docker Socket
Writable Docker Socket
If
/var/run/docker.sock is writable, you can talk to the daemon directly without being in the docker group.Privileged Container
Privileged Container
Privileged containers have all capabilities and can see host block devices. Mount the host drive and write to it directly.
CAP_SYS_ADMIN — Release Agent
CAP_SYS_ADMIN — Release Agent
A non-privileged container with Catch the shell on the attacker:
CAP_SYS_ADMIN and no AppArmor profile can abuse cgroup release agents to execute commands on the host.sudo docker exec Misconfiguration
sudo docker exec Misconfiguration
If
sudo -l shows (root) NOPASSWD: /usr/bin/docker exec *, you can exec into any running container as root.