Kubernetes attack paths (Tier 1) — exposed kubelet and API server, anonymous/over-permissive RBAC, service-account token abuse, etcd exposure, secrets in configmaps, and privileged/hostPath pods leading to node escape. Tools kube-hunter, peirates, kubeletctl, kubectl. Use when a cluster, kubelet, API server, or in-cluster foothold is in scope. Chains to container-escape for the node breakout.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of K8s Attacks?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-k8s-attacks)
---
name: k8s-attacks
description: Kubernetes attack paths (Tier 1) — exposed kubelet and API server, anonymous/over-permissive RBAC, service-account token abuse, etcd exposure, secrets in configmaps, and privileged/hostPath pods leading to node escape. Tools kube-hunter, peirates, kubeletctl, kubectl. Use when a cluster, kubelet, API server, or in-cluster foothold is in scope. Chains to container-escape for the node breakout.
---
# Kubernetes Attacks
Clusters fall via exposed control-plane/kubelet ports, weak RBAC, or a pod with a powerful service-account token or host mounts. Map identity → namespace → cluster-admin → node. Authorized clusters only; avoid disrupting workloads.
## Trigger phrases
`kubernetes, k8s, kubelet, kube-apiserver, rbac, service account token, etcd, privileged pod, hostpath, kube-hunter, peirates, eks, aks, gke`
## Method
1. **Discover (external/internal):** scan `6443` (API server), `10250`/`10255` (kubelet r/w + read-only), `2379-2380` (etcd), `10256`, `30000-32767` (NodePorts), dashboard. `kube-hunter --remote <ip>` / `--pod` from inside.
2. **Anonymous access:** `curl -k https://<api>:6443/api` and `/version`; test `system:anonymous` → `kubectl --insecure-skip-tls-verify auth can-i --list`. Kubelet: `kubeletctl -i --server <node> pods` / `scan rce` (run commands in pods via `/run`).
3. **In-pod service-account token:** `/var/run/secrets/kubernetes.io/serviceaccount/{token,ca.crt,namespace}`; `kubectl --token=$TOK auth can-i --list`. `peirates` automates token use + privesc menu.
4. **RBAC abuse:** enumerate with `kubectl auth can-i --list`, `kubectl get roles,rolebindings,clusterroles,clusterrolebindings -A`. Dangerous verbs: `create pods` (schedule privileged pod), `create pods/exec`, `get/list secrets`, `escalate`/`bind`, `impersonate`, `*` on `*`, `create clusterrolebindings`.
5. **Secrets & config:** `kubectl get secrets -A -o yaml`, service-account tokens, configmaps with creds, mounted cloud credentials (IRSA/workload identity → `cloud-pivot-finder`).
6. **etcd:** if `2379` reachable without client cert, `etcdctl get / --prefix --keys-only` → read all secrets/tokens (cluster game over).
7. **Privileged/hostPath pod → node:** if you can create pods, schedule one with `hostPID`, `privileged: true`, or `hostPath: /` mount → read node filesystem / `nsenter` into host → `container-escape`.
## Modern / rare techniques
- **[NEW] IngressNightmare (CVE-2025-1974 + CVE-2025-24513/24514/1097/1098)**: unauthenticated RCE in ingress-nginx admission controller via injected NGINX config from a crafted AdmissionReview — reachable on the internal admission webhook (`:8443`); fingerprint ingress-nginx version and flag <1.11.5/<1.12.1.
- **[RARE] Kubelet read-only port 10255** leaks pod specs, env vars and tokens with no auth.
- **[NEW] Workload-identity/IRSA token → cloud**: pod SA maps to a cloud role; steal the projected token and pivot (→ `cloud-pivot-finder`).
- **[RARE] `nodes/proxy` or `pods/exec` RBAC** = effective command execution across the cluster.
- **[NEW] Admission-controller / OPA-Gatekeeper bypass** via unconstrained namespaces to schedule privileged pods.
## Escalation / chaining
Cluster-admin or node shell → `container-escape` (breakout) → `linux-discovery` on node → cloud metadata → `cloud-pivot-finder`. Secrets → lateral to apps/DBs.
## Backend & tooling
Kali/WSL-Kali/HexStrike: `kubectl`, `kube-hunter`, `peirates`, `kubeletctl`, `etcdctl`, `nuclei` (k8s templates), `trivy k8s`. `kub'scape`/`kube-bench` for config posture (read-only breadth).
## Verification (background, before reporting)
Re-confirm each access independently (e.g., `can-i --list` with the token AND an actual low-impact read like listing a non-sensitive resource) and distinguish real anonymous access from a proxy/WAF echo. For admission-controller RCE use an OAST callback rather than a destructive payload. Report confirmed only.
## Evidence
Reachable port + unauth response, `can-i --list` output, token source path, a single proof read (redacted secret/etcd key), and the pod spec used for node access. Remediation: disable anonymous auth, least-privilege RBAC, restrict kubelet (`--anonymous-auth=false`, webhook authz), mTLS on etcd, Pod Security Admission (restrict privileged/hostPath), patch ingress-nginx, network-policy the admission webhook.