Container breakout risk: privileged pods, host mounts, and capabilities
Containers share the host kernel, so some settings remove the isolation that remains. How to find privileged containers, host path mounts, and dangerous capabilities with kubectl and policy tools, and enforce Pod Security Standards.
Diagram
Settings that weaken container isolation
Step 1 of 4
Privileged
Full access to host devices.
securityContext: privileged: true
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Privileged pods
- What fails
- privileged: true removes most isolation.
- Who is affected
- The node and every pod on it.
- What you would notice
- Pods with privileged true outside system namespaces.
- What you change
- Enforce the restricted or baseline Pod Security Standard.
Runtime socket mounts
- What fails
- Mounting the Docker or containerd socket lets a pod control the host’s containers.
- Who is affected
- The node.
- What you would notice
- hostPath volumes pointing at runtime sockets.
- What you change
- Remove them; use build services that do not need the socket.
Capabilities
- What fails
- Capabilities like SYS_ADMIN grant kernel-level power.
- Who is affected
- The node.
- What you would notice
- Added capabilities beyond NET_BIND_SERVICE.
- What you change
- Drop ALL and add back only what is needed.
Finding risky pods
Query the cluster for the settings directly, or run a scanner such as kube-bench for node configuration and Trivy’s Kubernetes mode for workload misconfigurations.
$ kubectl get pods -A -o json | jq -r '.items[] | select(.spec.containers[].securityContext.privileged==true) | "\(.metadata.namespace)/\(.metadata.name)"' monitoring/node-exporter-7x2kq ci/build-runner-5f9c $ trivy k8s --report summary cluster
Runtime detection
Falco and similar tools alert on suspicious behavior inside containers, such as a shell spawning in a production pod or writes to sensitive host paths.
Check yourself
Recognition and the fix. Nothing here is a procedure.
Why is mounting /var/run/docker.sock into a pod risky?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.
This page stands on its own. The lab and the glossary card are the next reading.