auditing-kubernetes-rbac-privilege-escalation
Teaches your AI agent to ship projects and manage infrastructure.
What it does
This tool checks access permissions in a Kubernetes cluster to find potentially dangerous security configurations. It looks for ways a user or service might gain more privileges than intended, such as becoming a cluster administrator.
When to use it
- ✓When reviewing the security of a Kubernetes cluster.
- ✓After compromising a service to see what else it can access.
- ✓To ensure permissions are the minimum necessary after changes.
Example of what to ask your AI
“Check for privilege escalation permissions in my Kubernetes cluster.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool uses specific Kubernetes commands to analyze who is allowed to do what. It looks for combinations of permissions that, together, could allow someone to gain full control of the cluster.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill auditing-kubernetes-rbac-privilege-escalationOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/auditing-kubernetes-rbac-privilege-escalation/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Auditing Kubernetes RBAC Privilege Escalation
Legal Notice: This skill is for authorized security testing and educational purposes only. Enumerating and exercising RBAC permissions affects a live cluster's access posture. Only test clusters you own or are explicitly authorized in writing to assess.
Overview
Kubernetes Role-Based Access Control (RBAC, MITRE ATT&CK T1078 Valid Accounts) governs what every user and service account may do via Role/ClusterRole rules bound by RoleBinding/ClusterRoleBinding. Because workloads run with a mounted service-account token by default, an attacker who compromises one pod inherits that account's RBAC rights. Over-permissive bindings turn a single compromised pod into a cluster takeover: certain verbs and resources are "RBAC-equivalent to cluster-admin."
Per the Kubernetes "RBAC Good Practices" guidance and Unit 42 research, the dangerous primitives are:
escalateon roles — grant yourself any permission, even ones you do not hold.bindon clusterroles — create a binding tocluster-admin.impersonateon users/groups/serviceaccounts — act as any subject includingsystem:masters.create/update/patchonpods— schedule a privileged pod or mount the node, escaping to the host (T1611).createonpods/exec,pods/attach,pods/ephemeralcontainers— run code in any existing pod.get/list/watchonsecrets— list returns full secret contents, including other service-account tokens.createonserviceaccounts/token— mint tokens for more privileged accounts.update/patchonvalidatingwebhookconfigurations/mutatingwebhookconfigurations,nodes/proxy,certificatesigningrequests/approval— admission/CSR abuse to cluster-admin.- Wildcards (
verbs: ["*"],resources: ["*"]) — implicit super-privilege.
This skill systematically enumerates effective permissions for every subject, maps which subjects hold these escalation primitives, and produces remediation evidence. Source: Kubernetes RBAC Good Practices; Unit 42 Kubernetes RBAC research.
When to Use
- During an authorized Kubernetes security assessment or cluster penetration test
- After compromising a pod, to determine what its service-account token can reach
- When reviewing RBAC drift before a production go-live
- When validating least-privilege after a platform migration or Helm rollout
Prerequisites
kubectlconfigured against the target cluster (your own credentials, or a captured service-account token)- Read access to RBAC objects (most audits run with a cluster-reader or admin context)
- Audit tooling:
# rbac-police - find escalation paths (Cymulate) curl -L https://github.com/PaloAltoNetworks/rbac-police/releases/latest/download/rbac-police-linux-amd64 -o rbac-police chmod +x rbac-police # kubectl-who-can - which subjects can perform an action (Aqua) kubectl krew install who-can # rakkess - access matrix of resources x verbs for the current/another subject kubectl krew install access-matrix # rbac-lookup - which roles a subject has (FairwindsOps) kubectl krew install rbac-lookup
Objectives
- Inventory all
Role,ClusterRole,RoleBinding, andClusterRoleBindingobjects - Enumerate effective permissions per subject using
kubectl auth can-i --as - Identify subjects holding RBAC-equivalent-to-admin primitives
- Trace token-mounting pods to over-privileged service accounts
- Demonstrate (in a lab) one escalation path end-to-end
- Output a prioritized findings report with least-privilege remediation
MITRE ATT&CK Mapping
| Technique ID | Name | Tactic |
|---|---|---|
| T1078 | Valid Accounts | Defense Evasion / Persistence / Privilege Escalation |
| T1098 | Account Manipulation | Persistence |
| T1528 | Steal Application Access Token | Credential Access |
| T1613 | Container and Resource Discovery | Discovery |
| T1611 | Escape to Host | Privilege Escalation |
Workflow
Step 1: Inventory RBAC Objects
# All roles and bindings, cluster-wide
kubectl get clusterroles,clusterrolebindings -o wide
kubectl get roles,rolebindings --all-namespaces -o wide
# Dump full RBAC for offline analysis
kubectl get clusterroles,clusterrolebindings,roles,rolebindings \
--all-namespaces -o yaml > rbac-dump.yaml
# Who is bound to cluster-admin?
kubectl get clusterrolebindings -o json | \
…
FAQ
What is RBAC?
RBAC (Role-Based Access Control) is a system that defines who can do what within Kubernetes, based on roles and permissions.
What does 'privilege escalation' mean?
It's when a user or service with limited permissions manages to gain greater permissions, potentially leading to full system control.
Why are overly broad permissions dangerous?
If an attacker gains access to an account with broad permissions, they can control the entire cluster, access sensitive data, or cause damage.
Details
Original description by the author
Finds over-permissive RBAC roles and service-account token abuse paths in a Kubernetes cluster using kubectl auth can-i, rbac-police, kubectl-who-can, and rakkess, tracing which subjects can escalate toward cluster-admin. Use when reviewing who can escalate privileges in a cluster, hunting exploitable RoleBindings during an authorized review, or validating least privilege after an RBAC change. Key
Popularity
- GitHub stars
- 35k
- Ranking position
- #5519
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
bun-runtime
Has your agent use Bun to run, organize, and test code. It helps choose Bun over other tools and migrate existing projects.
affaan-m/ECC
database-migrations
Helps your agent make safe changes to databases. It ensures changes can be undone and minimizes downtime.
affaan-m/ECC
deployment-patterns
Sets up deployment and CI/CD workflows, containerization, and rollback strategies to ensure safe releases.
affaan-m/ECC