Lesson 2 of 14 · 13m
The Three Namespaces That Matter
Mount, PID, and network namespaces each privatize a different table, and each host-mode flag deliberately unbuilds one of them.
Mount namespaces: a copy, with drilled holes
CLONE_NEWNS hands the process a private copy of the mount table. Mount something inside the container and /proc/mounts outside never sees it. This is why a container can have a completely different / — Docker pivot_roots into the image layers, and the host's tree simply stops existing for that process.
Then the bind mount undoes it. docker run -v /srv/data:/data asks the daemon to mount a host path into the container's namespace, so the same directory appears in two mount tables. That is not a leak — it is the feature. Every -v, every Kubernetes hostPath, is a hole drilled deliberately through the wall. The question in an audit is never "are mounts isolated" but "which holes did someone drill."
Mount propagation decides whether the hole leaks further. A mount made with shared propagation pushes new mounts to its peers — a mount created inside the container can appear on the host. Docker defaults to rprivate, which is safe. Kubernetes defaults to None. Setting mountPropagation: Bidirectional on a volume mount asks for the leak on purpose, and there is almost never a reason to want it.
PID namespaces: who is allowed to see whom
CLONE_NEWPID gives the process a private numbering scheme. Inside, the container's init is PID 1; outside, it is some large host PID. The container cannot enumerate host processes — /proc inside the container only shows PIDs the namespace knows.
Two consequences people miss.
First, PID 1 is special on Linux in ways that have nothing to do with isolation. Orphaned children reparent to PID 1, which must wait() on them or they become zombies that never exit. And PID 1 gets no default signal dispositions — send SIGTERM to a process that never installed a handler and the kernel ignores it. That is why your Node or Java app ignores docker stop for ten seconds and dies on the SIGKILL timeout, and why docker run --init exists: it inserts tini, a real init that reaps children and forwards signals, as PID 1.
Second, --pid=host deletes the entire boundary. The container enumerates every host process: /proc/<pid>/cmdline, /proc/<pid>/environ (environment variables, which is where secrets live), /proc/<pid>/exe. Reading another process's environ requires ptrace-mode privileges or matching credentials, but root-in-a-shared-pid-ns has them against most of the host.
Network namespaces: the loopback lie
CLONE_NEWNET gives the container an empty stack: lo, no interfaces, no routes. Docker then builds plumbing — a veth pair with one end renamed eth0 inside the container and the other plugged into the docker0 bridge, plus iptables rules that NAT outbound traffic. ip netns lists namespaces created that way; nsenter -t <pid> -n ip addr shows you the container's view.
--network=host skips the plumbing and shares the host stack. The container can now bind any port and reach anything bound to loopback. This is the loopback lie: an enormous amount of software binds 127.0.0.1 assuming it means "only processes on this machine." A host-network container is a process on this machine. Redis on 127.0.0.1:6379, a metrics exporter on 127.0.0.1:9100, an admin socket with no auth — all reachable, and usually unauthenticated because whoever bound them trusted loopback.
The same applies to --ipc=host (container reads SysV shared memory segments alongside host processes) and --uts=host (harmless alone, a hostname is just a string). Kubernetes exposes all of these as hostPID, hostNetwork, hostIPC in the pod spec — one YAML key each, same boundary deleted.
What to actually do
For a running container, check docker inspect: .HostConfig.NetworkMode, .PidMode, .IpcMode, .Binds, and .Mounts. Anything set to host is an escape assist. For Kubernetes, grep pod specs for hostPID, hostNetwork, hostIPC, hostPath, and mountPropagation: Bidirectional. And stop treating 127.0.0.1 as an access control — on any host that runs host-network workloads, loopback is a network interface, not a trust boundary.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.
A Password-Free Path to Root: Inside the macOS Screen Sharing Vulnerability Now Under Attack
A logic bug in screensharingd let attackers skip authentication entirely and land as root — no password required. Here's how it was found, patched, reverse-engineered, and finally weaponized.
CVE-2026-31431 "Copy Fail": How a 9-Year-Old Linux Kernel Bug Gives Any Local User Root in 732 Bytes
CVE-2026-31431 chains AF_ALG, splice(), and authencesn's ESN scratch write into a deterministic 4-byte page cache write that gives an unprivileged local user root. Full technical breakdown, exploit mechanics, detection, mitigation, and patch status per distro.
BlueHammer: The Unpatched Windows Zero-Day That Weaponizes Microsoft Defender Against Your Own System
BlueHammer is an unpatched, publicly released Windows local privilege escalation exploit that chains Microsoft Defender's update workflow, Volume Shadow Copy, Cloud Files callbacks, and opportunistic locks to reach NT AUTHORITY\SYSTEM from a standard user account.