Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 346

Docker Socket Attack

What is Docker Socket Attack?

Docker Socket AttackAbusing a container that has /var/run/docker.sock mounted to control the Docker daemon, escape the container, and gain root on the host.


The Docker socket /var/run/docker.sock is an unauthenticated control plane for the Docker daemon, which runs as root on the host. When a container mounts the socket (commonly done to give CI runners, monitoring agents, or sidecars access to Docker), any process inside can call the daemon API. An attacker who reaches that container can create a new privileged container that bind-mounts the host filesystem at /, install a backdoor, read /etc/shadow, or pivot to the host network namespace. Mitigations: never bind-mount docker.sock into untrusted containers, use rootless Docker, expose the daemon over TLS with mTLS, or replace direct access with restricted brokers like sysbox or kaniko.

Examples

  1. 01

    Compromising a Jenkins agent container that mounts /var/run/docker.sock and spawning a new container with --privileged -v /:/host.

  2. 02

    An attacker inside Portainer's container using the bound socket to enumerate and start root containers.

Frequently asked questions

What is Docker Socket Attack?

Abusing a container that has /var/run/docker.sock mounted to control the Docker daemon, escape the container, and gain root on the host. It belongs to the Attacks & Threats category of cybersecurity.

What does Docker Socket Attack mean?

Abusing a container that has /var/run/docker.sock mounted to control the Docker daemon, escape the container, and gain root on the host.

How does Docker Socket Attack work?

The Docker socket /var/run/docker.sock is an unauthenticated control plane for the Docker daemon, which runs as root on the host. When a container mounts the socket (commonly done to give CI runners, monitoring agents, or sidecars access to Docker), any process inside can call the daemon API. An attacker who reaches that container can create a new privileged container that bind-mounts the host filesystem at /, install a backdoor, read /etc/shadow, or pivot to the host network namespace. Mitigations: never bind-mount docker.sock into untrusted containers, use rootless Docker, expose the daemon over TLS with mTLS, or replace direct access with restricted brokers like sysbox or kaniko.

How do you defend against Docker Socket Attack?

Defences for Docker Socket Attack typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Docker Socket Attack?

Common alternative names include: docker.sock mount escape, Container escape via Docker socket.

Related terms