Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.10
- Impact: Host Compromise & Service Denial. When a container shares the host’s network namespace, it lives “outside” the container isolation. It can open reserved low-numbered ports, access critical network services like D-Bus on the host, and even potentially shut down the Docker host or spoof network traffic.
Common Misconfiguration
Setting the networking mode tohost (--net=host). This instructs Docker not to containerize the networking, effectively giving the container full access to the host’s network interfaces.
Vulnerable Example
Secure Example
Audit Procedure
Run the command below to inspect the network mode of all containers:- Result: Check the
NetworkModevalue for each container. - Fail: If it returns
NetworkMode=host. - Pass: If it returns
default,bridge, or the name of a custom network.
Remediation
You should not pass the--net=host option when starting any container unless there is a very specific, unavoidable reason. By default, containers connect to the Docker bridge and do not run in the context of the host’s network stack.
