企业网站宣传,无锡住房和城乡建设局网站,深圳城乡和建设局网站,自己搭建的网站可以收费吗Kubernetes RBAC配置不当攻击场景攻击过程 RBAC配置不当
Service Account本质是服务账号#xff0c;是Pod连接K8s集群的凭证。 在默认情况下#xff0c;系统会为创建的Pod提供一个默认的Service Account#xff0c;
用户也可以自定义Service Account#xff0c;与Service… Kubernetes RBAC配置不当攻击场景攻击过程 RBAC配置不当
Service Account本质是服务账号是Pod连接K8s集群的凭证。 在默认情况下系统会为创建的Pod提供一个默认的Service Account
用户也可以自定义Service Account与Service Account关联的凭证会自动挂载到Pod的文件系统中。
当攻击者通过某个web应用获取到一个Pod权限时如果RBAC权限配置不当
Pod关联的Service Account拥有创建Pod的权限。
攻击者就可以使用污点容忍的方式将挂载根目录的恶意Pod调度到Master节点获取Master 节点上的 kubeconfig 文件从而直接接管整个集群。
攻击场景
1Service Account赋予bypass对test名称空间拥有管理员权限。 kubectl create serviceaccount bypass -n test
kubectl create rolebinding sa-admin --clusterrolecluster-admin --serviceaccounttest:bypass -n test
kubectl get pod --assystem:serviceaccount:test:bypass2在Pod中使用自定义的Service Account。 # pod-sa.yaml
apiVersion: v1
kind: Pod
metadata:name: pod-sanamespace: test
spec:serviceAccountName: bypasscontainers:- name: ubuntuimage: ubuntu:20.04command: [/bin/sh,-c,sleep 24h]3在Pod创建时Service Account关联的凭证
会挂载到 /var/run/secrets/kubernetes.io/serviceaccount/ 目录 其中ca.crt是证书、namespace是Pod所属的命名空间 token是访问API Server的令牌 。 攻击过程
1攻击方式kubectl 命令行操作 2攻击方式curl 命令操作