Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
Kubernetes RBAC controls who and what can do what in a cluster — and over-permissive roles are how a compromised pod or a stolen credential becomes cluster-wide compromise. A service account with too many rights, a role that grants * on everything, or the ability to create pods (and thus run arbitrary containers) can all lead to takeover. This skill covers auditing RBAC for the excessive permissions that create those escalation paths, the cluster equivalent of the cloud IAM-privesc review.
When to use it
Auditing a Kubernetes cluster's security posture, after deployment, or when assessing whether a compromised workload could escalate. RBAC misconfiguration is a leading cause of Kubernetes compromise, making this a high-value audit.
Procedure
- Enumerate roles, cluster roles, and their bindings. Map who (users, groups, service accounts) has what permissions.
kubectl and tools like rbac-tool or kubectl-who-can help visualise it:kubectl get clusterroles,roles,clusterrolebindings,rolebindings -A
rbac-tool policy-rules -e '.*' # who can do what
kubectl who-can create pods # who can perform a dangerous action
- Hunt wildcard and overly-broad permissions.
verbs: ["*"], resources: ["*"], or apiGroups: ["*"] grant far more than almost anything needs. cluster-admin bound to a workload service account is the worst case. These broad grants are the primary finding.
- Identify the escalation-enabling permissions specifically. Certain permissions are dangerous because they lead to more:
create/update on pods — lets you run arbitrary containers (mount host paths, use privileged, access other secrets) — effectively code execution in the cluster.
- secrets access (
get/list) — read credentials, including other service accounts' tokens.
create on rolebindings/clusterrolebindings — grant yourself more permissions (RBAC escalation).
escalate/bind verbs, impersonate, exec into pods, token creation — all privilege-escalation primitives.
- Focus on service accounts, not just users. Workload service accounts are what a compromised pod uses; an over-permissioned SA means a compromised pod inherits those rights. Default service accounts with excessive permissions are a common, dangerous pattern.
- Check for the default-token exposure. Pods that mount a service-account token they don't need hand that token to any compromise; disable automounting where the workload doesn't call the API.
- Trace escalation paths. Like cloud IAM, the risk is a chain — a pod's SA can read a secret that's a more privileged SA's token, or create a pod as a privileged SA. Map how a low-priv foothold could reach cluster-admin.
- Report the specific over-grants and the escalation paths — the fix is tightening the role/binding, not a generic "improve RBAC".
Cheatsheet
RBAC = who/what can do what in the cluster ; over-permission = pod/cred -> cluster takeover
enumerate: kubectl get clusterroles,roles,*bindings -A
rbac-tool policy-rules | kubectl who-can <verb> <resource>
RED FLAGS
verbs/resources/apiGroups = ["*"] | cluster-admin bound to a workload SA
escalation-enabling permissions (dangerous -> lead to more)
create/update PODS -> run arbitrary containers (hostPath/privileged/other secrets)
get/list SECRETS -> read creds incl. other SA tokens
create *ROLEBINDINGS -> grant yourself more (RBAC escalation)
escalate / bind / impersonate / pods/exec / token creation
focus on SERVICE ACCOUNTS (compromised pod inherits SA rights)
default SA w/ excessive perms = common danger ; disable unused token automount
trace ESCALATION CHAINS (pod SA -> read a privileged SA token -> ...)
Reading the audit
- A workload service account bound to
cluster-admin or with wildcard permissions = a compromised pod using that SA owns the cluster; the worst and most impactful RBAC finding. Scope it to the minimum immediately.
create/update on pods granted broadly = effectively cluster code execution; whoever has it can run privileged containers, mount host paths, and reach other secrets. A subtle but critical over-grant.
- secrets
get/list on a broad scope = the SA can read credentials including other service accounts' tokens, enabling escalation to more privileged identities.
create on rolebindings, or escalate/impersonate verbs = direct RBAC self-escalation — the SA can grant itself more. High severity.
- An over-permissioned default service account = every pod using it inherits the rights; a common, dangerous default that turns any pod compromise into more.
- A traced chain from a low-priv SA to cluster-admin = the real risk, expressed as the exact escalation path; that path is what to break.
- Least-privilege roles scoped to specific verbs/resources/namespaces = the good state; a compromised workload gains little.
The fix
- Least privilege on every role and binding — grant only the specific verbs, resources, and namespaces a workload needs, never
*. This is the direct remediation.
- No
cluster-admin for workloads — reserve it for genuine cluster administration, never bind it to a service account.
- Constrain the escalation-enabling permissions (pod create, secrets, rolebinding create, impersonate/escalate) tightly, and keep them out of workload SAs.
- Per-workload service accounts with minimal rights, not shared or default SAs; disable token automounting for pods that don't need the API.
- Namespace-scope roles where possible rather than cluster-wide, to limit blast radius.
- Audit continuously — RBAC drifts as teams add permissions; re-audit regularly and use admission control (that skill) to prevent dangerous grants.
Pitfalls
- Wildcard permissions.
* on verbs/resources/apiGroups grants far more than needed and is the root of most RBAC over-permission. Scope explicitly.
- cluster-admin on workloads. Binding it to a service account means any pod compromise is cluster compromise. Never do it for workloads.
- Overlooking escalation-enabling verbs. pod create, secrets access, rolebinding create, and impersonate/escalate lead to more privilege even without obvious admin rights. Audit for these specifically.
- Ignoring service accounts. Users get attention but workload SAs are what compromised pods use; over-permissioned SAs (especially defaults) are the real risk.
- Auditing once. RBAC accumulates permissions over time; re-audit and enforce with admission control.
References
- Kubernetes RBAC documentation and CIS Kubernetes Benchmark
- rbac-tool, kubectl-who-can, and Kubernetes RBAC audit tooling
- The cloud iam-privilege-escalation skill (same reasoning), pod-security-standards, and admission-control skills
- MITRE ATT&CK for Containers
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: kubernetes-rbac-audit3description: Use when auditing Kubernetes RBAC for over-permissive roles and bindings — the excessive permissions that let a compromised workload or user take over the cluster.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314Kubernetes RBAC controls who and what can do what in a cluster — and over-permissive roles are how a compromised pod or a stolen credential becomes cluster-wide compromise. A service account with too many rights, a role that grants `*` on everything, or the ability to create pods (and thus run arbitrary containers) can all lead to takeover. This skill covers auditing RBAC for the excessive permissions that create those escalation paths, the cluster equivalent of the cloud IAM-privesc review.1516### When to use it1718Auditing a Kubernetes cluster's security posture, after deployment, or when assessing whether a compromised workload could escalate. RBAC misconfiguration is a leading cause of Kubernetes compromise, making this a high-value audit.1920### Procedure21221. **Enumerate roles, cluster roles, and their bindings.** Map who (users, groups, service accounts) has what permissions. `kubectl` and tools like `rbac-tool` or `kubectl-who-can` help visualise it:23 ```24 kubectl get clusterroles,roles,clusterrolebindings,rolebindings -A25 rbac-tool policy-rules -e '.*' # who can do what26 kubectl who-can create pods # who can perform a dangerous action27 ```282. **Hunt wildcard and overly-broad permissions.** `verbs: ["*"]`, `resources: ["*"]`, or `apiGroups: ["*"]` grant far more than almost anything needs. `cluster-admin` bound to a workload service account is the worst case. These broad grants are the primary finding.293. **Identify the escalation-enabling permissions specifically.** Certain permissions are dangerous because they lead to more:30 - **`create`/`update` on pods** — lets you run arbitrary containers (mount host paths, use privileged, access other secrets) — effectively code execution in the cluster.31 - **secrets access (`get`/`list`)** — read credentials, including other service accounts' tokens.32 - **`create` on rolebindings/clusterrolebindings** — grant yourself more permissions (RBAC escalation).33 - **`escalate`/`bind` verbs, `impersonate`, exec into pods, token creation** — all privilege-escalation primitives.344. **Focus on service accounts, not just users.** Workload service accounts are what a compromised pod uses; an over-permissioned SA means a compromised pod inherits those rights. Default service accounts with excessive permissions are a common, dangerous pattern.355. **Check for the default-token exposure.** Pods that mount a service-account token they don't need hand that token to any compromise; disable automounting where the workload doesn't call the API.366. **Trace escalation paths.** Like cloud IAM, the risk is a *chain* — a pod's SA can read a secret that's a more privileged SA's token, or create a pod as a privileged SA. Map how a low-priv foothold could reach cluster-admin.377. **Report the specific over-grants** and the escalation paths — the fix is tightening the role/binding, not a generic "improve RBAC".3839### Cheatsheet4041```42RBAC = who/what can do what in the cluster ; over-permission = pod/cred -> cluster takeover4344enumerate: kubectl get clusterroles,roles,*bindings -A45 rbac-tool policy-rules | kubectl who-can <verb> <resource>4647RED FLAGS48 verbs/resources/apiGroups = ["*"] | cluster-admin bound to a workload SA4950escalation-enabling permissions (dangerous -> lead to more)51 create/update PODS -> run arbitrary containers (hostPath/privileged/other secrets)52 get/list SECRETS -> read creds incl. other SA tokens53 create *ROLEBINDINGS -> grant yourself more (RBAC escalation)54 escalate / bind / impersonate / pods/exec / token creation5556focus on SERVICE ACCOUNTS (compromised pod inherits SA rights)57 default SA w/ excessive perms = common danger ; disable unused token automount58trace ESCALATION CHAINS (pod SA -> read a privileged SA token -> ...)59```6061### Reading the audit6263- **A workload service account bound to `cluster-admin` or with wildcard permissions** = a compromised pod using that SA owns the cluster; the worst and most impactful RBAC finding. Scope it to the minimum immediately.64- **`create`/`update` on pods granted broadly** = effectively cluster code execution; whoever has it can run privileged containers, mount host paths, and reach other secrets. A subtle but critical over-grant.65- **secrets `get`/`list` on a broad scope** = the SA can read credentials including other service accounts' tokens, enabling escalation to more privileged identities.66- **`create` on rolebindings, or `escalate`/`impersonate` verbs** = direct RBAC self-escalation — the SA can grant itself more. High severity.67- **An over-permissioned default service account** = every pod using it inherits the rights; a common, dangerous default that turns any pod compromise into more.68- **A traced chain from a low-priv SA to cluster-admin** = the real risk, expressed as the exact escalation path; that path is what to break.69- **Least-privilege roles scoped to specific verbs/resources/namespaces** = the good state; a compromised workload gains little.7071### The fix7273- **Least privilege on every role and binding** — grant only the specific verbs, resources, and namespaces a workload needs, never `*`. This is the direct remediation.74- **No `cluster-admin` for workloads** — reserve it for genuine cluster administration, never bind it to a service account.75- **Constrain the escalation-enabling permissions** (pod create, secrets, rolebinding create, impersonate/escalate) tightly, and keep them out of workload SAs.76- **Per-workload service accounts** with minimal rights, not shared or default SAs; disable token automounting for pods that don't need the API.77- **Namespace-scope roles** where possible rather than cluster-wide, to limit blast radius.78- **Audit continuously** — RBAC drifts as teams add permissions; re-audit regularly and use admission control (that skill) to prevent dangerous grants.7980### Pitfalls8182- **Wildcard permissions.** `*` on verbs/resources/apiGroups grants far more than needed and is the root of most RBAC over-permission. Scope explicitly.83- **cluster-admin on workloads.** Binding it to a service account means any pod compromise is cluster compromise. Never do it for workloads.84- **Overlooking escalation-enabling verbs.** pod create, secrets access, rolebinding create, and impersonate/escalate lead to more privilege even without obvious admin rights. Audit for these specifically.85- **Ignoring service accounts.** Users get attention but workload SAs are what compromised pods use; over-permissioned SAs (especially defaults) are the real risk.86- **Auditing once.** RBAC accumulates permissions over time; re-audit and enforce with admission control.8788### References8990- Kubernetes RBAC documentation and CIS Kubernetes Benchmark91- rbac-tool, kubectl-who-can, and Kubernetes RBAC audit tooling92- The cloud iam-privilege-escalation skill (same reasoning), pod-security-standards, and admission-control skills93- MITRE ATT&CK for Containers9495## Inputs96- Relevant source code, logs, network traces, or system specifications.9798## Outputs99- Analysis findings, security audit report, or generated code artifacts.