欢迎访问 内存溢出 —— 独立后端与系统工程技术博客

专注于分布式系统、Linux内核、数据库存储与后端工程实践

Kubernetes 容器逃逸:特权容器配置与 runC CVE-2019-5736 原理

发表于:|最后更新:|分类:云原生安全|阅读:1230 次

容器本质上是利用 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: /