Course contentsShow
← Security
Lesson 1628 of 3,05233. Container SecurityFree lesson

Host Resource Access Threats

Identifying risks from mounting host paths, Docker socket, and other host resources into containers.

Host Resource Access Threats

What you'll learn: How mounting host paths, Docker sockets, and other host resources into containers creates dangerous security vulnerabilities.

The Core Problem

Containers share the host kernel and can be granted access to host resources like filesystems, devices, and sockets. When you mount sensitive host paths or the Docker socket into a container, you're essentially handing that container keys to the kingdom—even if it appears isolated.

Think of it like renting a room in your house: normally the tenant stays in their space, but if you give them a key to your safe, your car, and your office, they can access everything you own. That's what happens when containers mount critical host resources.

Common Threat Vectors

Mounting Host Paths

Binding host directories like /etc, /root, or /var/run into containers allows processes inside to read—or worse, modify—critical system files. An attacker escaping application-level restrictions could rewrite /etc/passwd or inject malicious systemd services.

Docker Socket Exposure

Mounting /var/run/docker.sock is particularly dangerous. The Docker socket is the control plane for the Docker daemon. A container with socket access can spawn new privileged containers, inspect all containers on the host, or execute commands in any container—effectively gaining root access to the entire host.

Device and Resource Access

Mounting devices (/dev) or kernel interfaces (/proc, /sys) grants low-level hardware and kernel access that bypasses container isolation entirely.

Real-World Impact

Attackers exploiting these misconfigurations can pivot from compromised container processes to full host compromise, steal secrets from other containers, establish persistence outside container lifecycles, or manipulate the container orchestration layer itself.

Key Takeaway: Mounting host paths, the Docker socket, or system devices into containers dramatically expands the attack surface by breaking container isolation—treat these configurations as granting near-root host access and avoid them unless absolutely necessary with strict controls.