Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.2.5
- Impact: Traffic Sniffing & Policy Bypass. A container running in the host’s network namespace (
hostNetwork: true) bypasses the Kubernetes network overlay. It can:- Sniff Traffic: See all network traffic entering and leaving the node.
- Access Localhost: Connect to services listening on
127.0.0.1on the host (e.g., the Kubelet API, unauthenticated database ports). - Bypass Policies: Ignore NetworkPolicies that restrict pod-to-pod communication.
Common Misconfiguration
EnablinghostNetwork: true for performance reasons or to simplify access to external services. This is also common for ingress controllers or CNI plugins, but it should be strictly prohibited for standard application workloads.
Vulnerable Example
Secure Example
Audit Procedure
Run the following command to check for pods using the host network namespace:- Result: The output will list the pod name followed by its
hostNetworksetting. - Fail: If you see
truefor any pod that is not a known system component (likekube-proxy,calico-node, or an Ingress Controller).
Remediation
Add policies to each namespace in the cluster which has user workloads to restrict the admission ofhostNetwork containers.
Using Pod Security Admission:
Apply the baseline or restricted profile to your namespaces. Both profiles strictly forbid hostNetwork: true.

