Lion Cipher Lab

Lock down an exposed Docker daemon socket

Why it matters

The Docker daemon exposes a full REST API, and that API can do anything root can do on the host — pull and run images, bind-mount the host filesystem into a container, read every secret on the box. By default that API is served only over a unix socket at /var/run/docker.sock, a file owned by root and readable only by root and the `docker` group, so the blast radius is 'a local privileged user.' The misconfiguration that turns that into a disaster is a single configuration choice: telling the daemon to ALSO listen on a TCP port (classically 2375) with no TLS and no authentication. The moment…

What you'll learn

Steps in this lab

  1. Before anything: this is YOUR loopback host, and that is why it is defense
  2. What the Docker daemon API is, and why reaching it means root
  3. Inspect the default protection: a root-only unix socket
  4. Reproduce the misconfiguration — safely, on loopback only
  5. MEASURE (before): curl the open port and get root, no password
  6. The honest judgment: what is and isn't a defense here
  7. Lock it down: remove the TCP listener, back to the socket
  8. MEASURE (after): the same curl now gets 'Connection refused'
  9. When remote access is genuinely needed: mutual TLS, not an open port
  10. Do it better — the reflex to carry out of this lab

Open the full interactive lab →