Skip to main content
security · kubernetes

Workloads sharing the node network namespace outside system namespaces

resource types
3
rule IDs covered
9
severity
high

What does ZopNight detect here?

Setting `hostNetwork: true` puts a pod directly on the node's network stack, so NetworkPolicy no longer applies to it and it can bind any of the 65,535 node ports. ZopNight skips the 7 system namespace patterns where CNI and node agents legitimately need this.

Signal and threshold

How ZopNight evaluates Workloads sharing the node network namespace outside system namespaces.
Field Value
Rule IDsRC-1729 · RC-1829 · RC-1929 · RC-1730 · RC-1830 · RC-1930 · RC-1731 · RC-1831 · RC-1931
Categorysecurity
Severityhigh
Metricnone — pure configuration read
Sourceinternal/rules/k8s/host_network.go

What host networking actually removes

A pod with hostNetwork: true does not get its own network namespace. It uses the node’s.

Three protections disappear at once, and only the first is widely understood.

NetworkPolicy stops applying. Policies select pods by their pod IP. A host-networked pod has the node IP, so ingress and egress rules written against it match nothing. A default-deny namespace policy does not constrain this pod at all, yet the policy object still shows as applied.

Port binding becomes unrestricted. The container can listen on any port the node has free. Nothing reserves the kubelet’s port, the CNI’s, or a monitoring agent’s; the first process to bind wins.

Node-local services become reachable. Anything listening on 127.0.0.1 on that node (kubelet’s read-only endpoints, a metadata proxy, a local sidecar) is now localhost from inside the container.

The exclusions are deliberate, not gaps

Seven namespace patterns are skipped: kube-system, kube-public, kube-node-lease, calico-system, tigera-operator, gke-managed-* and aks-managed-*. CNI agents, kube-proxy and node monitoring genuinely require the host stack, and flagging them produces noise that trains people to ignore the whole category.

A workload outside those namespaces is a different matter. Application teams almost never need it, and it usually arrives copied from an example manifest rather than chosen.

hostPort is the narrower tool

Where the requirement is genuinely “reachable on the node’s IP at a known port”, a hostPort on the single container port does that, and leaves the pod’s own network namespace, and therefore its NetworkPolicy coverage, intact.

That distinction is the useful part of this finding. The answer is rarely “you cannot do this”; it is “you asked for one port and were given the whole stack”.

When the rule stays silent

No recommendation is produced when the discoverer did not capture a hostNetwork key for the workload at all. Absent metadata is treated as unknown, not as false, since the rule will not assert a security finding it cannot substantiate.

Listing pods with hostNetwork set to true

Terminal window
kubectl get pods -A -o json | jq -r '
.items[] | select(.spec.hostNetwork == true)
| select(.metadata.namespace | test("^(kube-|calico-system|tigera-operator|gke-managed|aks-managed)") | not)
| "\(.metadata.namespace)/\(.metadata.name)"'

Enforce it cluster-wide with the Pod Security Standards restricted profile, which forbids hostNetwork outright. One namespace label beats auditing manifests forever.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

417 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

417 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·