hackweb
notes on hacking and technology
IT EN
main menu
user menu
you are not logged in

Container escape: breaking out to the host

February 1, 2025 · 1 min read · #cloud #containers #docker

Containers share the host kernel. Isolation comes from namespaces, cgroups and capabilities: weakening them opens the way to the host.

The escape routes

--privileged: near-total access to host devices; mount the host disk and read/write everything.

CAP_SYS_ADMIN or SYS_PTRACE capability: abuse cgroup release_agent, or inject into host processes.

hostPath / mounted sockets: a mount of / or the docker socket gives host control.

# classic cgroup v1 release_agent abuse (privileged container)
# writes a command the kernel runs on the host

Defence

Never --privileged. Drop all capabilities and add back the minimum. User namespaces (rootless), seccomp and AppArmor/SELinux profiles. No sensitive host mounts. gVisor/Kata for stronger isolation when needed.


« back to home

latest posts
 
your IP address:
216.73.216.108
visitor #1
MOTD:
Every abstraction leaks somewhere.
Here we look at where.
topics