How does a container escape typically happen?
AdvancedConceptKubernetes Security
Answer
Containers share the host kernel, so an escape is either a misconfiguration or a kernel/runtime bug:
- Misconfiguration: privileged pod, mounted container runtime socket, writable hostPath,
CAP_SYS_ADMINwith cgroup v1release_agentabuse. - Runtime bug: e.g. CVE-2019-5736 (runc binary overwrite) and CVE-2024-21626 (runc leaked file descriptor giving host filesystem access via
WORKDIR). - Kernel bug: Dirty Pipe (CVE-2022-0847) and similar privilege escalations.
Defences: restricted PSS, seccomp, patched runc/containerd and node kernels, user namespaces (hostUsers: false), and sandboxed runtimes such as gVisor or Kata Containers for untrusted workloads.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate