Hands-on Lab·Kubernetes and Cloud Native Security Associate
Privilege Escalation Paths in RBAC
Auditing RBAC by reading it does not scale - there are 74 ClusterRoles on a cluster with nothing installed. This guide is the three queries that answer the questions that matter, and what a good answer looks like.
Security Fundamentals Guide 20 of 42 Intermediate
- Kubernetesapiserver v1.36.4, kubelet v1.36.3
- Runtimecontainerd 2.2.6
- CNICilium 1.18.1
- Built withkubeadm v1.36.3
- TimeAbout 14 min
The built-in ClusterRoles and bindings are Kubernetes' own, on a kubeadm cluster with no add-ons beyond a CNI. Counts on a real cluster will be higher and the queries are the same.
- Host kernel7.0.0-29
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA5001 | 192.168.0.41 | Ubuntu 26.04 LTS | Control Plane Node (tainted NoSchedule) | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE01 | 192.168.0.42 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE02 | 192.168.0.43 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE03 | 192.168.0.44 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when auditing RBAC on a real cluster. This matters because reading it does not scale - there are dozens of ClusterRoles before anybody adds one of their own, so the audit has to be a query rather than a read.
- querying who holds cluster-admin, the one answer that ought to be short
- querying what an entirely unauthenticated caller can reach
- counting what you would otherwise have had to read by hand
Before you start
- guide 18 - how a grant is made.
-
Who holds cluster-admin
-
What an unauthenticated caller can reach
-
Why you query instead of reading