Skip to content
Back to Blog
·10 min read·technology

Kubernetes Penetration Testing: How Attackers Hit Clusters

An authorised Kubernetes penetration testing methodology covering exposed API servers, RBAC abuse, token theft, node escape, and defence for Indian teams.

BR

Bachao.AI Research Team

Cybersecurity Research

Scan Your Attack Surface

Security exposure this creates

Unpatched vulnerabilities in your tech stack are the #1 entry point for breaches targeting Indian businesses. Here's what to watch.

Kubernetes penetration testing is an authorised, methodology-driven attack simulation against a cluster's API server, kubelet, etcd, RBAC configuration, and workloads — distinct from a hardening checklist because it proves what an attacker can actually reach, not just what's misconfigured on paper. Real-world cluster compromises follow a repeatable chain: find an exposed component, abuse over-permissioned RBAC, steal a service account token, escalate to node access, then move laterally. Indian teams running Kubernetes on managed cloud platforms are exposed to this exact chain, and this guide walks through it, mapping every attack step to the defence that closes it.

Why Kubernetes Penetration Testing Needs Its Own Methodology

Kubernetes clusters aren't a single application — they're a control plane, a container runtime, a networking layer, and an identity system bundled together, each with its own attack surface. A web app pentest that stops at the ingress misses the API server behind it, the kubelet agent on every node, the service account tokens mounted into every pod, and the RBAC bindings deciding what a compromised workload can do next. A dedicated Kubernetes pentest walks this chain: enumerate exposed components, abuse identity, escalate from container to node, extract secrets — the same sequence a real attacker follows.

🛡️
SECURITY
Every technique in this guide requires a signed authorisation letter or statement of work naming the specific cluster, namespace scope, and time window. Testing Kubernetes infrastructure you're not contracted to assess is an offence under Sections 43 and 66 of India's IT Act, 2000.

Step One: Finding the Exposed Component

Every Kubernetes attack chain starts with reconnaissance against the components attackers scan for first: the API server, kubelet, etcd, and the Dashboard.

    1. API server (default port 6443) — the front door to the cluster. Reachable from the internet without proper authentication, or with anonymous access enabled, it hands an attacker a direct path to cluster resources.
    2. Kubelet API (port 10250, read-only 10255) — runs on every node; if unauthenticated, it allows arbitrary command execution inside any pod on that node via the exec and run endpoints.
    3. etcd (port 2379) — the cluster's datastore, holding every Secret and resource definition in plaintext unless encryption at rest is configured. An exposed, unauthenticated etcd instance is the entire cluster's data in one place.
    4. Kubernetes Dashboard — historically deployed with a permissive service account by default; a publicly reachable dashboard with skip-login enabled gives an attacker a GUI straight into cluster administration.
kubectl cluster-info dump
nmap -p 6443,10250,10255,2379,2380 <node-ip>
curl -k https://<node-ip>:10250/pods
⚠️
WARNING
An unauthenticated kubelet read-only port (10255) returns a full list of running pods, images, and environment variables to anyone who can reach it — no credentials required. This single misconfiguration has been the initial foothold in numerous documented cluster compromises.

Step Two: RBAC Abuse and Privilege Escalation

Once inside the cluster — through a compromised pod, a leaked kubeconfig, or an exposed API server — the next move is enumerating what the identity is allowed to do. RBAC is granular by design, but most clusters accumulate over-permissioned bindings: cluster-admin granted for convenience, service accounts bound to roles broader than the workload needs, or wildcard verbs (*) on custom roles.

kubectl auth can-i --list
kubectl get clusterrolebindings -o wide
kubectl get rolebindings --all-namespaces -o wide

The critical checks: does the identity have create on pods, bind on roles, or impersonate on users? Any of these chains into a privilege escalation. A service account that can create pods can spin one up mounting a more privileged service account's token, or running privileged with a hostPath mount into the node's filesystem — turning namespace-scoped access into node-level compromise.

🚨
DANGER
create on pods combined with the ability to set serviceAccountName is a direct privilege escalation path — an attacker spins up a pod that mounts a higher-privilege service account's token and reads it from inside, no RBAC bypass required.

Know your vulnerabilities before attackers do

Run a free VAPT scan — takes 5 minutes, no signup required.

Book Your Free Scan

Step Three: Service Account Token Theft

Every pod, unless configured otherwise, gets a service account token automatically mounted at /var/run/secrets/kubernetes.io/serviceaccount/token. This token authenticates the pod to the API server with whatever RBAC permissions its bound service account carries — the single most valuable artefact inside a compromised container.

cat /var/run/secrets/kubernetes.io/serviceaccount/token
kubectl --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) get pods --all-namespaces

Once extracted, the token can be replayed against the API server directly, often from outside the cluster, giving persistent access that survives the original pod being killed. Clusters leaving automountServiceAccountToken: true on workloads that never call the API — most application pods, in practice — hand out unnecessary, exploitable credentials by default.

Step Four: Container-to-Node Escape

A stolen token or initial RCE inside a container is valuable, but the higher-value target is the underlying node — full host access means access to every other pod scheduled on it. Common escape vectors:

    1. Privileged containers. A pod running with privileged: true has near-full access to host devices and kernel capabilities — escaping to the node is close to trivial.
    2. hostPath volume mounts. Mounting the host filesystem, especially / or /var/run/docker.sock, gives direct read/write access to the node; the socket mount alone allows spinning up new privileged containers on the host.
    3. hostPID / hostNetwork. Sharing the host's process or network namespace breaks container isolation, exposing host processes and interfaces to the container.
    4. Dangerous capabilities. CAP_SYS_ADMIN and similar, granted without full privileged mode, can still chain into a node escape through kernel-level operations.
kubectl get pods -o jsonpath='{.items[*].spec.containers[*].securityContext}'
kubectl get pods -o json | grep -i hostpath

Step Five: Secrets Extraction

With node or elevated API access, the next target is Secrets — API keys, database credentials, TLS certificates, cloud tokens. Kubernetes Secrets are base64-encoded, not encrypted, by default; anyone who can read one decodes it in one command.

kubectl get secrets --all-namespaces
kubectl get secret <name> -o jsonpath='{.data}' | base64 -d

If etcd encryption at rest isn't configured, every Secret also sits in plaintext inside etcd's data files on disk, reachable to anyone with node-level filesystem access — a second path to the same data that bypasses the API entirely.

Step Six: Lateral Movement

Cluster network policies are permissive by default — without an explicit NetworkPolicy resource, every pod can reach every other pod across every namespace. An attacker who's compromised one workload uses this default-allow posture to reach adjacent services and internal APIs never meant to sit inside that workload's blast radius. Lateral movement inside a cluster is often faster than across a flat network, because most teams assume the cluster boundary is itself a security boundary — it isn't, without explicit network policies enforcing it.

CERT-In publishes advisories on container and orchestration vulnerabilities that Indian Kubernetes teams should track alongside routine patch management.

Attack Chain to Remediation

graph TD A[Find Exposed Component] -->|API server kubelet etcd dashboard| B[Abuse RBAC] B -->|Over permissioned roles| C[Steal Service Account Token] C -->|Replay token| D[Escape to Node] D -->|Privileged access| E[Remediate and Harden] style A fill:#1e3a5f,stroke:#3B82F6,color:#e2e8f0 style B fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style C fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style D fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style E fill:#1e3d2f,stroke:#10B981,color:#e2e8f0
73%Indian SMBs reporting no formal security audit of production infrastructure (DSCI 2025)
35%YoY rise in attacks targeting Indian SMB digital infrastructure (CERT-In 2025)

Container and orchestration platforms fall squarely inside that unaudited majority — most Indian teams running Kubernetes have never had the cluster itself, as opposed to the applications on it, independently tested.

Attack Surface Distribution Across a Typical Cluster

Based on common findings across authorised Kubernetes engagements, misconfigured identity and access controls dominate the exploitable surface more than any single exposed port:

pie title Kubernetes Attack Surface Distribution "RBAC Misconfiguration" : 28 "Exposed API Server" : 20 "Service Account Token Exposure" : 18 "Privileged Containers" : 15 "Exposed Kubelet" : 11 "Exposed etcd Dashboard" : 8

Attack Vector to Defence Mapping

Attack techniqueWhat it targetsDefence that closes it
Exposed API serverAnonymous access to the control planeDisable anonymous auth, restrict to a private network or VPN
Unauthenticated kubeletPod listing and command execution on a nodeEnable kubelet auth, disable the read-only port
Exposed etcdPlaintext access to all cluster secretsRestrict to control-plane-only access, enable client certs
Over-permissioned RBACPrivilege escalation via broad rolesApply least-privilege roles, audit cluster-admin bindings
Service account token exposurePersistent API access from a compromised podSet automountServiceAccountToken: false, use bound tokens
Privileged containers, hostPath mountsContainer-to-node escapeEnforce Pod Security Standards via admission control
Base64 Secrets in etcdPlaintext credential extractionEnable etcd encryption at rest, use a secrets manager
Default-allow pod networkingLateral movement across namespacesDeploy NetworkPolicy enforcing default-deny
💡
TIP
Admission controllers such as Pod Security Admission (the successor to the deprecated PodSecurityPolicy) enforce "no privileged containers, no hostPath, no hostPID" cluster-wide at deploy time — turning a manual audit checklist into an automatic gate that rejects non-compliant pod specs.

Where an External Kubernetes Pentest Adds Value

Cluster configuration drifts constantly — a new namespace gets a broad ClusterRoleBinding during a rushed deploy, a debugging pod gets privileged: true and is never cleaned up, a NetworkPolicy is deleted during troubleshooting and doesn't return. Internal reviews catch some of this; a structured, independent penetration test — walking the exact chain above, delivered with a CERT-In empanelled partner where regulatory submission is required — catches what accumulates between audits.

Bachao.AI builds cluster-level attack surface visibility into its continuous VAPT pipeline, so Indian engineering teams get identity, RBAC, and container-escape testing without a dedicated cluster security engineer running manual audits every sprint. Dhisattva AI Pvt Ltd built the platform around the reality that most Indian teams adopted Kubernetes for scale and never tested what that layer exposes.

🎯Key Takeaway
A Kubernetes compromise is rarely a single exploit — it's a chain: an exposed component gives initial access, over-permissioned RBAC turns that access into a stolen token, and a container escape turns the token into node or cluster control. Breaking any one link, especially RBAC and default service account mounting, stops the chain even if the initial exposure isn't caught first.

Next Steps

Kubernetes penetration testing has to walk the same chain an attacker walks — exposed component, RBAC abuse, token theft, node escape, lateral movement — because testing each layer in isolation misses the escalation paths that make clusters worth attacking. Run this methodology against your own authorised cluster on a fixed schedule, and treat every ClusterRoleBinding and mounted service account token as something needing a documented reason to exist.

Want visibility into what your cluster actually exposes to an attacker? Get a free VAPT scan, or browse the blog for more hands-on security methodology. If your cluster processes personal data under India's privacy law, also review our DPDP compliance guide.

Frequently Asked Questions

What is Kubernetes penetration testing and how is it different from a hardening checklist?
Kubernetes penetration testing is an authorised attack simulation that actively exploits misconfigurations across the API server, RBAC, service accounts, and containers to prove real impact, rather than listing settings that deviate from best practice. A hardening checklist tells you what's misconfigured; a pentest proves what an attacker can reach.
What is the most common initial access point in Kubernetes attacks?
Exposed, unauthenticated components are the most common entry point — an internet-reachable API server with anonymous access enabled, an unauthenticated kubelet API, or exposed etcd. These give a foothold before any RBAC or container-level exploitation is needed.
How does RBAC misconfiguration lead to privilege escalation in Kubernetes?
Over-permissioned roles or bindings that allow create on pods combined with setting a serviceAccountName let a low-privilege identity spin up a pod mounting a more privileged service account's token. This turns namespace-scoped access into cluster-wide compromise without any RBAC bypass, since the permission model itself allows the chain.
What is a service account token and why is it a high-value target?
A service account token is automatically mounted into most pods and authenticates that pod to the API server with the permissions of its bound service account. Once extracted, it can be replayed from outside the compromised pod for persistent access — why setting automountServiceAccountToken: false on workloads that don't call the API is a key defence.
How do attackers escape from a container to the underlying node?
Common paths are privileged containers, hostPath mounts (especially the Docker or containerd socket), sharing the host's process or network namespace, and dangerous kernel capabilities. Each breaks container isolation and gives access to the node, and from there, every other pod scheduled on it.
Why does default Kubernetes networking make lateral movement easier for attackers?
Without explicit NetworkPolicy resources, every pod can reach every other pod across all namespaces by default. A compromised workload can reach adjacent services and internal APIs immediately — why default-deny network policies are a baseline control, not an optional extra.
BR

Bachao.AI Research Team

Cybersecurity Research

AI-powered security research and threat intelligence from the Bachao.AI team. Covering the latest vulnerabilities, CVEs, and cybersecurity developments affecting Indian businesses.

Get cybersecurity insights for Indian SMBs

Weekly vulnerability alerts, DPDP compliance tips, and security guides. No spam — unsubscribe anytime.

We respect your privacy. Your email is never shared.

Find out if you're exposed to this class of threat

Free automated scan — risk score in under 2 hours. No credit card required.

Scan Your Attack Surface
Find your vulnerabilitiesStart free scan →