Impact & Risk Analysis
- Severity: Critical
- CIS Benchmark: CIS 5.32
- Impact: Full Host Compromise. The Docker socket (
/var/run/docker.sock) is the main entry point for the Docker API. If this socket is mounted inside a container, processes within that container can execute Docker commands. This allows an attacker to create new privileged containers, mount the host’s root filesystem, and effectively gain root access to the entire host server.
Common Misconfiguration
Mounting the Docker socket to allow a container to manage other containers. This is common in CI/CD agents (like Jenkins or GitLab Runner) and management tools (like Portainer), but it breaks the container isolation model completely.Vulnerable Example
Secure Example
Audit Procedure
Run the following command to check for mapped sockets:- Result: The command returns any instances where
docker.sockhas been mapped to a container as a volume. - Fail: If any output is returned.
- Pass: If the command returns no output.
Remediation
You should ensure that no containers mountdocker.sock as a volume. If your application requires Docker interaction, investigate safer alternatives such as using the Docker API over a secured network connection or using a restricted socket proxy that filters dangerous commands.
