Lion Cipher Lab

Escape a container through a mounted Docker socket

Why it matters

Bind-mounting the Docker daemon socket into a container — `-v /var/run/docker.sock:/var/run/docker.sock` — is one of the most common configurations in real infrastructure, and one of the most dangerous. CI runners do it so a build job can build images. Monitoring agents (cAdvisor, Portainer, Watchtower, countless dashboards) do it so they can list and inspect containers. Reverse-proxy automation does it to watch for new containers. Every one of those is handing the container a direct line to the host's Docker daemon, and the Docker daemon runs as root and can do anything root can do. The…

What you'll learn

Steps in this lab

  1. Before anything else: this runs on YOUR throwaway host, and here is why that matters
  2. What the Docker socket actually is, and why touching it means root
  3. The trap: 'it's just for the CI runner' (why this misconfig is everywhere)
  4. Build the vulnerable container (the real-world pattern, on your lab host)
  5. Confirm you can reach the host daemon (two ways)
  6. The escape: mount the host's whole filesystem and read /etc/shadow
  7. The honest negative: the hardening you'd reach for does NOTHING here
  8. Measure the fix: remove the socket and watch the same escape fail
  9. When a container really does need Docker: a read-only socket proxy
  10. Detect it: Falco alerts on the socket and on privileged launches
  11. Do it better — the judgment to carry out of this lab

Open the full interactive lab →