容器本质上是利用 Linux 内核的 Namespace 和 Cgroups 实现的隔离环境。若 Pod 配置了过度宽松的特权(如 privileged: true)或挂载了宿主机的 /var/run/docker.sock,攻击者即可直接逃逸到宿主节点。
一、特权容器挂载宿主机根目录风险
yaml
apiVersion: v1
kind: Pod
metadata:
name: misconfigured-pod
spec:
containers:
- name: exploit-container
image: alpine
securityContext:
privileged: true
volumeMounts:
- mountPath: /host
name: host-root
volumes:
- name: host-root
hostPath:
path: /