[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71CKMZDK5AV8P23V0TT13F4":3,"skill-same:01M71CKMZDK5AV8P23V0TT13F4":88},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":14,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":6,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M71CKMZDK5AV8P23V0TT13F4","kubernetes-general-overview-analyze",null,"Auditing Kubernetes cluster RBAC configurations to identify overly permissive roles, wildcard permissions, dangerous ClusterRoleBindings, service account abuse, and privilege escalation paths using kubectl, rbac-tool, KubiScan, and Kubeaudit.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fkubernetes\u002Fgeneral\u002Foverview\u002Fanalyze\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"kubernetes","general","overview","kubernetes general overview analyze","analyze","auditing kubernetes cluster rbac","read","rbac","privilege escalation","aks","cloud-security","gke","eks","de","permissions","kubeaudit","Bash","access","cybersecurity","cm","2026-11-10 10:12:30",false,"---\nname: kubernetes-general-overview-analyze\ndescription: Auditing Kubernetes cluster RBAC configurations to identify overly permissive roles, wildcard permissions, dangerous ClusterRoleBindings, service account abuse, and privilege escalation paths using kubectl, rbac-tool, KubiScan, and Kubeaudit.\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- cloud-security\n- kubernetes\n- rbac\n- access-control\n- eks\n- gke\n- aks\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmodel: sonnet\nmaxTurns: 20\ntools: [Read, Bash, Glob, Grep]\nmitre_attack:\n- T1021\n- T1610\ncapec: []\n---\n\n# Auditing Kubernetes Cluster RBAC\n\n## When to Use\n\n- When performing security assessments of Kubernetes clusters (EKS, GKE, AKS, or self-managed)\n- When validating that RBAC policies enforce least privilege for users and service accounts\n- When investigating potential lateral movement or privilege escalation within a Kubernetes cluster\n- When compliance audits require documentation of access controls and permissions\n- When onboarding new teams to a shared cluster and defining appropriate RBAC policies\n\n**Do not use** for network policy auditing (use Cilium or Calico network policy tools), for container image scanning (use Trivy or Grype), or for runtime security monitoring (use Falco or Sysdig Secure).\n\n## Prerequisites\n\n- kubectl configured with cluster-admin or equivalent read permissions to the target cluster\n- rbac-tool installed (`kubectl krew install rbac-tool` or binary from GitHub)\n- KubiScan installed (`pip install kubiscan`)\n- Kubeaudit installed (`brew install kubeaudit` or from GitHub releases)\n- Access to the cluster's audit logs for correlating RBAC findings with actual API access\n\n## Workflow\n\n### Step 1: Enumerate ClusterRoles and Roles with Dangerous Permissions\n\nIdentify roles with wildcard permissions, secret access, pod exec, or escalation capabilities.\n\n```bash\n# List all ClusterRoles with wildcard verb access\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        verbs = rule.get('verbs', [])\n        resources = rule.get('resources', [])\n        if '*' in verbs or '*' in resources:\n            print(f'ClusterRole: {name}')\n            print(f'  Verbs: {verbs}')\n            print(f'  Resources: {resources}')\n            print(f'  API Groups: {rule.get(\\\"apiGroups\\\", [])}')\n            print()\n\"\n\n# Find roles that can read secrets\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        resources = rule.get('resources', [])\n        verbs = rule.get('verbs', [])\n        if ('secrets' in resources or '*' in resources) and ('get' in verbs or 'list' in verbs or '*' in verbs):\n            if not name.startswith('system:'):\n                print(f'ClusterRole: {name} -> can access secrets (verbs: {verbs})')\n\"\n\n# Find roles with pod\u002Fexec permissions (container escape risk)\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        resources = rule.get('resources', [])\n        if 'pods\u002Fexec' in resources or 'pods\u002F*' in resources:\n            print(f'ClusterRole: {name} -> has pods\u002Fexec access')\n\"\n```\n\n### Step 2: Audit ClusterRoleBindings and RoleBindings\n\nReview bindings to identify who has elevated access and detect overly broad group assignments.\n\n```bash\n# List all ClusterRoleBindings with the subjects\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    name = binding['metadata']['name']\n    role = binding['roleRef']['name']\n    subjects = binding.get('subjects', [])\n    for subject in subjects:\n        kind = subject.get('kind', '')\n        subj_name = subject.get('name', '')\n        ns = subject.get('namespace', 'cluster-wide')\n        print(f'{name} -> Role: {role} | {kind}: {subj_name} ({ns})')\n\" | sort\n\n# Find bindings to cluster-admin\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    if binding['roleRef']['name'] == 'cluster-admin':\n        print(f\\\"Binding: {binding['metadata']['name']}\\\")\n        for subject in binding.get('subjects', []):\n            print(f\\\"  {subject.get('kind')}: {subject.get('name')} (ns: {subject.get('namespace', 'N\u002FA')})\\\")\n\"\n\n# Find bindings granting access to all authenticated users\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    for subject in binding.get('subjects', []):\n        if subject.get('name') in ['system:authenticated', 'system:unauthenticated']:\n            print(f\\\"WARNING: {binding['metadata']['name']} grants {binding['roleRef']['name']} to {subject['name']}\\\")\n\"\n```\n\n### Step 3: Scan with rbac-tool for Comprehensive Analysis\n\nUse rbac-tool for automated RBAC analysis including who-can queries and policy generation.\n\n```bash\n# Who can get secrets across all namespaces\nkubectl rbac-tool who-can get secrets\n\n# Who can create pods (potential for container escape)\nkubectl rbac-tool who-can create pods\n\n# Who can exec into pods\nkubectl rbac-tool who-can create pods\u002Fexec\n\n# Who can escalate privileges (bind\u002Fescalate verbs)\nkubectl rbac-tool who-can bind clusterroles\nkubectl rbac-tool who-can escalate clusterroles\n\n# Generate RBAC policy report\nkubectl rbac-tool analysis\n\n# Visualize RBAC relationships\nkubectl rbac-tool viz --outformat dot > rbac-graph.dot\ndot -Tpng rbac-graph.dot -o rbac-graph.png\n```\n\n### Step 4: Run KubiScan for Risky Permissions Detection\n\nUse KubiScan to automatically identify risky service accounts, pods, and RBAC configurations.\n\n```bash\n# Run KubiScan to find risky roles\npython3 -m kubiscan -rroles   # List risky Roles\npython3 -m kubiscan -rcr      # List risky ClusterRoles\npython3 -m kubiscan -rrb      # List risky RoleBindings\npython3 -m kubiscan -rcrb     # List risky ClusterRoleBindings\n\n# Find risky service accounts\npython3 -m kubiscan -rs       # Risky service accounts\n\n# Find pods running with risky service accounts\npython3 -m kubiscan -rp       # Risky pods\n\n# Check for privilege escalation paths\npython3 -m kubiscan -pe       # Privilege escalation vectors\n\n# Generate full report\npython3 -m kubiscan -a        # All checks\n```\n\n### Step 5: Audit Service Account Token Mounting and Usage\n\nCheck for unnecessary service account token mounts that could enable lateral movement from compromised pods.\n\n```bash\n# Find pods with automounted service account tokens\nkubectl get pods --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor pod in data['items']:\n    name = pod['metadata']['name']\n    ns = pod['metadata']['namespace']\n    sa = pod['spec'].get('serviceAccountName', 'default')\n    automount = pod['spec'].get('automountServiceAccountToken', True)\n    if automount and sa != 'default':\n        print(f'{ns}\u002F{name} -> SA: {sa} (token auto-mounted)')\n\"\n\n# Find service accounts with non-default token secrets\nkubectl get serviceaccounts --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor sa in data['items']:\n    name = sa['metadata']['name']\n    ns = sa['metadata']['namespace']\n    secrets = sa.get('secrets', [])\n    if name != 'default' and len(secrets) > 0:\n        print(f'{ns}\u002F{name}: {len(secrets)} secret(s) bound')\n\"\n\n# Check for pods running as privileged or with host access\nkubectl get pods --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor pod in data['items']:\n    name = pod['metadata']['name']\n    ns = pod['metadata']['namespace']\n    for container in pod['spec'].get('containers', []):\n        sc = container.get('securityContext', {})\n        if sc.get('privileged', False) or sc.get('runAsUser', 1) == 0:\n            print(f'RISK: {ns}\u002F{name}\u002F{container[\\\"name\\\"]} - privileged={sc.get(\\\"privileged\\\",False)} runAsRoot={sc.get(\\\"runAsUser\\\",\\\"not set\\\")==0}')\n\"\n```\n\n### Step 6: Run Kubeaudit for RBAC and Security Policy Validation\n\nExecute Kubeaudit for comprehensive security checks including RBAC-related findings.\n\n```bash\n# Run all kubeaudit checks\nkubeaudit all --kubeconfig ~\u002F.kube\u002Fconfig\n\n# Run specific RBAC-related checks\nkubeaudit privesc    # Check for allowPrivilegeEscalation\nkubeaudit rootfs     # Check for readOnlyRootFilesystem\nkubeaudit nonroot    # Check for runAsNonRoot\nkubeaudit capabilities  # Check for dangerous capabilities\n\n# Output as JSON for processing\nkubeaudit all --kubeconfig ~\u002F.kube\u002Fconfig -f json > kubeaudit-results.json\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| RBAC | Role-Based Access Control in Kubernetes, a method for regulating access to cluster resources based on the roles of individual users or service accounts |\n| ClusterRole | Cluster-wide role definition that specifies permissions (verbs on resources) applicable across all namespaces |\n| ClusterRoleBinding | Associates a ClusterRole with subjects (users, groups, service accounts) at the cluster scope |\n| Service Account | Identity associated with pods for authenticating to the Kubernetes API server, automatically mounted unless disabled |\n| automountServiceAccountToken | Pod spec field controlling whether the service account token is automatically mounted into the pod filesystem |\n| Privilege Escalation | RBAC verbs (bind, escalate, impersonate) that allow a user to grant themselves or others elevated permissions |\n\n## Tools & Systems\n\n- **kubectl**: Primary CLI for querying Kubernetes RBAC resources (roles, bindings, service accounts)\n- **rbac-tool**: kubectl plugin for RBAC analysis including who-can queries, visualization, and policy generation\n- **KubiScan**: Python tool for scanning Kubernetes RBAC for risky permissions and privilege escalation paths\n- **Kubeaudit**: Security auditing tool that checks pods and workloads for security anti-patterns including RBAC issues\n- **rakkess**: kubectl plugin showing access matrix for the current user across all resource types\n\n## Common Scenarios\n\n### Scenario: Auditing an EKS Cluster Shared by Multiple Development Teams\n\n**Context**: A shared EKS cluster serves four development teams. RBAC was configured during initial setup but has not been reviewed in 12 months. Teams report being able to access other teams' namespaces.\n\n**Approach**:\n1. List all ClusterRoleBindings to identify bindings granting broad access to authenticated users\n2. Run `kubectl rbac-tool who-can get secrets` to find subjects that can read secrets across namespaces\n3. Discover that a ClusterRoleBinding grants `edit` to `system:authenticated`, giving all users write access cluster-wide\n4. Run KubiScan to identify service accounts with risky permissions and pods running with elevated service accounts\n5. Replace the ClusterRoleBinding with namespace-scoped RoleBindings for each team\n6. Disable automountServiceAccountToken for workloads that do not need API access\n7. Create a NetworkPolicy to isolate namespace traffic between teams\n\n**Pitfalls**: Removing ClusterRoleBindings can break CI\u002FCD pipelines and operators that rely on cluster-wide access. Always audit which workloads use the bindings before removing them. EKS maps IAM roles to Kubernetes groups via aws-auth ConfigMap, so RBAC changes must be coordinated with IAM role mappings.\n\n## Output Format\n\n```\nKubernetes RBAC Audit Report\n===============================\nCluster: production-eks (EKS 1.28)\nAudit Date: 2026-02-23\nNamespaces: 12\n\nRBAC INVENTORY:\n  ClusterRoles: 48 (18 custom, 30 system)\n  ClusterRoleBindings: 32 (12 custom, 20 system)\n  Roles (namespaced): 24\n  RoleBindings (namespaced): 36\n  Service Accounts: 67\n\nCRITICAL FINDINGS:\n[RBAC-001] ClusterRoleBinding Grants edit to system:authenticated\n  Binding: authenticated-edit\n  Effect: ALL authenticated users have edit access across ALL namespaces\n  Risk: Any user can modify resources in any namespace\n  Remediation: Replace with namespace-scoped RoleBindings per team\n\n[RBAC-002] Custom ClusterRole with Wildcard Permissions\n  ClusterRole: developer-admin\n  Rules: verbs=[\"*\"], resources=[\"*\"], apiGroups=[\"*\"]\n  Bindings: 4 users via developer-admin-binding\n  Risk: Equivalent to cluster-admin without the name\n  Remediation: Scope to specific resources and verbs needed\n\nSUMMARY:\n  Principals with cluster-admin: 6 (recommended: \u003C= 3)\n  Roles with wildcard permissions: 4\n  Service accounts with secret access: 12\n  Pods with auto-mounted tokens: 45 \u002F 67\n  Privileged containers: 8\n```\n","# Auditing Kubernetes Cluster RBAC\n\n## When to Use\n\n- When performing security assessments of Kubernetes clusters (EKS, GKE, AKS, or self-managed)\n- When validating that RBAC policies enforce least privilege for users and service accounts\n- When investigating potential lateral movement or privilege escalation within a Kubernetes cluster\n- When compliance audits require documentation of access controls and permissions\n- When onboarding new teams to a shared cluster and defining appropriate RBAC policies\n\n**Do not use** for network policy auditing (use Cilium or Calico network policy tools), for container image scanning (use Trivy or Grype), or for runtime security monitoring (use Falco or Sysdig Secure).\n\n## Prerequisites\n\n- kubectl configured with cluster-admin or equivalent read permissions to the target cluster\n- rbac-tool installed (`kubectl krew install rbac-tool` or binary from GitHub)\n- KubiScan installed (`pip install kubiscan`)\n- Kubeaudit installed (`brew install kubeaudit` or from GitHub releases)\n- Access to the cluster's audit logs for correlating RBAC findings with actual API access\n\n## Workflow\n\n### Step 1: Enumerate ClusterRoles and Roles with Dangerous Permissions\n\nIdentify roles with wildcard permissions, secret access, pod exec, or escalation capabilities.\n\n```bash\n# List all ClusterRoles with wildcard verb access\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        verbs = rule.get('verbs', [])\n        resources = rule.get('resources', [])\n        if '*' in verbs or '*' in resources:\n            print(f'ClusterRole: {name}')\n            print(f'  Verbs: {verbs}')\n            print(f'  Resources: {resources}')\n            print(f'  API Groups: {rule.get(\\\"apiGroups\\\", [])}')\n            print()\n\"\n\n# Find roles that can read secrets\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        resources = rule.get('resources', [])\n        verbs = rule.get('verbs', [])\n        if ('secrets' in resources or '*' in resources) and ('get' in verbs or 'list' in verbs or '*' in verbs):\n            if not name.startswith('system:'):\n                print(f'ClusterRole: {name} -> can access secrets (verbs: {verbs})')\n\"\n\n# Find roles with pod\u002Fexec permissions (container escape risk)\nkubectl get clusterroles -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor role in data['items']:\n    name = role['metadata']['name']\n    for rule in role.get('rules', []):\n        resources = rule.get('resources', [])\n        if 'pods\u002Fexec' in resources or 'pods\u002F*' in resources:\n            print(f'ClusterRole: {name} -> has pods\u002Fexec access')\n\"\n```\n\n### Step 2: Audit ClusterRoleBindings and RoleBindings\n\nReview bindings to identify who has elevated access and detect overly broad group assignments.\n\n```bash\n# List all ClusterRoleBindings with the subjects\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    name = binding['metadata']['name']\n    role = binding['roleRef']['name']\n    subjects = binding.get('subjects', [])\n    for subject in subjects:\n        kind = subject.get('kind', '')\n        subj_name = subject.get('name', '')\n        ns = subject.get('namespace', 'cluster-wide')\n        print(f'{name} -> Role: {role} | {kind}: {subj_name} ({ns})')\n\" | sort\n\n# Find bindings to cluster-admin\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    if binding['roleRef']['name'] == 'cluster-admin':\n        print(f\\\"Binding: {binding['metadata']['name']}\\\")\n        for subject in binding.get('subjects', []):\n            print(f\\\"  {subject.get('kind')}: {subject.get('name')} (ns: {subject.get('namespace', 'N\u002FA')})\\\")\n\"\n\n# Find bindings granting access to all authenticated users\nkubectl get clusterrolebindings -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor binding in data['items']:\n    for subject in binding.get('subjects', []):\n        if subject.get('name') in ['system:authenticated', 'system:unauthenticated']:\n            print(f\\\"WARNING: {binding['metadata']['name']} grants {binding['roleRef']['name']} to {subject['name']}\\\")\n\"\n```\n\n### Step 3: Scan with rbac-tool for Comprehensive Analysis\n\nUse rbac-tool for automated RBAC analysis including who-can queries and policy generation.\n\n```bash\n# Who can get secrets across all namespaces\nkubectl rbac-tool who-can get secrets\n\n# Who can create pods (potential for container escape)\nkubectl rbac-tool who-can create pods\n\n# Who can exec into pods\nkubectl rbac-tool who-can create pods\u002Fexec\n\n# Who can escalate privileges (bind\u002Fescalate verbs)\nkubectl rbac-tool who-can bind clusterroles\nkubectl rbac-tool who-can escalate clusterroles\n\n# Generate RBAC policy report\nkubectl rbac-tool analysis\n\n# Visualize RBAC relationships\nkubectl rbac-tool viz --outformat dot > rbac-graph.dot\ndot -Tpng rbac-graph.dot -o rbac-graph.png\n```\n\n### Step 4: Run KubiScan for Risky Permissions Detection\n\nUse KubiScan to automatically identify risky service accounts, pods, and RBAC configurations.\n\n```bash\n# Run KubiScan to find risky roles\npython3 -m kubiscan -rroles   # List risky Roles\npython3 -m kubiscan -rcr      # List risky ClusterRoles\npython3 -m kubiscan -rrb      # List risky RoleBindings\npython3 -m kubiscan -rcrb     # List risky ClusterRoleBindings\n\n# Find risky service accounts\npython3 -m kubiscan -rs       # Risky service accounts\n\n# Find pods running with risky service accounts\npython3 -m kubiscan -rp       # Risky pods\n\n# Check for privilege escalation paths\npython3 -m kubiscan -pe       # Privilege escalation vectors\n\n# Generate full report\npython3 -m kubiscan -a        # All checks\n```\n\n### Step 5: Audit Service Account Token Mounting and Usage\n\nCheck for unnecessary service account token mounts that could enable lateral movement from compromised pods.\n\n```bash\n# Find pods with automounted service account tokens\nkubectl get pods --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor pod in data['items']:\n    name = pod['metadata']['name']\n    ns = pod['metadata']['namespace']\n    sa = pod['spec'].get('serviceAccountName', 'default')\n    automount = pod['spec'].get('automountServiceAccountToken', True)\n    if automount and sa != 'default':\n        print(f'{ns}\u002F{name} -> SA: {sa} (token auto-mounted)')\n\"\n\n# Find service accounts with non-default token secrets\nkubectl get serviceaccounts --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor sa in data['items']:\n    name = sa['metadata']['name']\n    ns = sa['metadata']['namespace']\n    secrets = sa.get('secrets', [])\n    if name != 'default' and len(secrets) > 0:\n        print(f'{ns}\u002F{name}: {len(secrets)} secret(s) bound')\n\"\n\n# Check for pods running as privileged or with host access\nkubectl get pods --all-namespaces -o json | python3 -c \"\nimport json, sys\ndata = json.load(sys.stdin)\nfor pod in data['items']:\n    name = pod['metadata']['name']\n    ns = pod['metadata']['namespace']\n    for container in pod['spec'].get('containers', []):\n        sc = container.get('securityContext', {})\n        if sc.get('privileged', False) or sc.get('runAsUser', 1) == 0:\n            print(f'RISK: {ns}\u002F{name}\u002F{container[\\\"name\\\"]} - privileged={sc.get(\\\"privileged\\\",False)} runAsRoot={sc.get(\\\"runAsUser\\\",\\\"not set\\\")==0}')\n\"\n```\n\n### Step 6: Run Kubeaudit for RBAC and Security Policy Validation\n\nExecute Kubeaudit for comprehensive security checks including RBAC-related findings.\n\n```bash\n# Run all kubeaudit checks\nkubeaudit all --kubeconfig ~\u002F.kube\u002Fconfig\n\n# Run specific RBAC-related checks\nkubeaudit privesc    # Check for allowPrivilegeEscalation\nkubeaudit rootfs     # Check for readOnlyRootFilesystem\nkubeaudit nonroot    # Check for runAsNonRoot\nkubeaudit capabilities  # Check for dangerous capabilities\n\n# Output as JSON for processing\nkubeaudit all --kubeconfig ~\u002F.kube\u002Fconfig -f json > kubeaudit-results.json\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| RBAC | Role-Based Access Control in Kubernetes, a method for regulating access to cluster resources based on the roles of individual users or service accounts |\n| ClusterRole | Cluster-wide role definition that specifies permissions (verbs on resources) applicable across all namespaces |\n| ClusterRoleBinding | Associates a ClusterRole with subjects (users, groups, service accounts) at the cluster scope |\n| Service Account | Identity associated with pods for authenticating to the Kubernetes API server, automatically mounted unless disabled |\n| automountServiceAccountToken | Pod spec field controlling whether the service account token is automatically mounted into the pod filesystem |\n| Privilege Escalation | RBAC verbs (bind, escalate, impersonate) that allow a user to grant themselves or others elevated permissions |\n\n## Tools & Systems\n\n- **kubectl**: Primary CLI for querying Kubernetes RBAC resources (roles, bindings, service accounts)\n- **rbac-tool**: kubectl plugin for RBAC analysis including who-can queries, visualization, and policy generation\n- **KubiScan**: Python tool for scanning Kubernetes RBAC for risky permissions and privilege escalation paths\n- **Kubeaudit**: Security auditing tool that checks pods and workloads for security anti-patterns including RBAC issues\n- **rakkess**: kubectl plugin showing access matrix for the current user across all resource types\n\n## Common Scenarios\n\n### Scenario: Auditing an EKS Cluster Shared by Multiple Development Teams\n\n**Context**: A shared EKS cluster serves four development teams. RBAC was configured during initial setup but has not been reviewed in 12 months. Teams report being able to access other teams' namespaces.\n\n**Approach**:\n1. List all ClusterRoleBindings to identify bindings granting broad access to authenticated users\n2. Run `kubectl rbac-tool who-can get secrets` to find subjects that can read secrets across namespaces\n3. Discover that a ClusterRoleBinding grants `edit` to `system:authenticated`, giving all users write access cluster-wide\n4. Run KubiScan to identify service accounts with risky permissions and pods running with elevated service accounts\n5. Replace the ClusterRoleBinding with namespace-scoped RoleBindings for each team\n6. Disable automountServiceAccountToken for workloads that do not need API access\n7. Create a NetworkPolicy to isolate namespace traffic between teams\n\n**Pitfalls**: Removing ClusterRoleBindings can break CI\u002FCD pipelines and operators that rely on cluster-wide access. Always audit which workloads use the bindings before removing them. EKS maps IAM roles to Kubernetes groups via aws-auth ConfigMap, so RBAC changes must be coordinated with IAM role mappings.\n\n## Output Format\n\n```\nKubernetes RBAC Audit Report\n===============================\nCluster: production-eks (EKS 1.28)\nAudit Date: 2026-02-23\nNamespaces: 12\n\nRBAC INVENTORY:\n  ClusterRoles: 48 (18 custom, 30 system)\n  ClusterRoleBindings: 32 (12 custom, 20 system)\n  Roles (namespaced): 24\n  RoleBindings (namespaced): 36\n  Service Accounts: 67\n\nCRITICAL FINDINGS:\n[RBAC-001] ClusterRoleBinding Grants edit to system:authenticated\n  Binding: authenticated-edit\n  Effect: ALL authenticated users have edit access across ALL namespaces\n  Risk: Any user can modify resources in any namespace\n  Remediation: Replace with namespace-scoped RoleBindings per team\n\n[RBAC-002] Custom ClusterRole with Wildcard Permissions\n  ClusterRole: developer-admin\n  Rules: verbs=[\"*\"], resources=[\"*\"], apiGroups=[\"*\"]\n  Bindings: 4 users via developer-admin-binding\n  Risk: Equivalent to cluster-admin without the name\n  Remediation: Scope to specific resources and verbs needed\n\nSUMMARY:\n  Principals with cluster-admin: 6 (recommended: \u003C= 3)\n  Roles with wildcard permissions: 4\n  Service accounts with secret access: 12\n  Pods with auto-mounted tokens: 45 \u002F 67\n  Privileged containers: 8\n```\n",{"name":5,"tags":44,"capec":46,"model":47,"tools":48,"domain":37,"maxTurns":52,"nist_csf":53,"subdomain":29,"description":7,"mitre_attack":58},[29,19,26,45,31,30,28],"access-control",[],"sonnet",[49,35,50,51],"Read","Glob","Grep",20,[54,55,56,57],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01",[59,60],"T1021","T1610","main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Fcloud\u002Fkubernetes\u002Fgeneral\u002Foverview\u002Fanalyze","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill kubernetes-general-overview-analyze",{"tool":74,"command":75},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill kubernetes-general-overview-analyze",{"tool":77,"command":78},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill kubernetes-general-overview-analyze","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fkubernetes\u002Fgeneral\u002Foverview\u002Fanalyze\u002FSKILL.md",true,[82],{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"index.json","REFERENCE","参考文档",716,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fkubernetes\u002Fgeneral\u002Foverview\u002Fanalyze\u002Findex.json",[89,99,122,143,163,185],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":93,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":98},"01M73MDK3NT5XHNYTQ5P5172V9","devel-jb-algorithmic-art","- Embed algorithms inline in the HTML artifact (don't create separate .","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":39},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[106,107,108,109,110,111,112,37,113,114,115,116,117,118,119,120,121,38,32],"services","detect","services wmi persistence detect","wmi","persistence","process-forensics","process","forensics","t1546.003","event-subscription","subscription","repository","commandline-consumer","subscriptions","event","activescript",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":39},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[129,109,130,106,131,132,35,133,134,37,135,136,137,138,139,25,140,141,32,142],"exec","services wmi exec exploit","exploit","across","analysis","team","traffic","remote","crackmapexec","Impacket","lateral-movement","lateral movement","command","native",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":39},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[150,151,152,153,154,47,155,156,157,158,25,32,159,23,133,160,35,37,161,162],"extract","registry artifact extract","registry","artifact","digital-forensics","regripper","windows-registry","evidence-collection","software","uncover","collection","artifact-analysis","activity",{"skillNo":164,"name":165,"nameZh":6,"description":166,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":169,"publishedAt":39},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[170,171,172,107,37,173,38,174,175,176,111,32,177,178,179,180,181,182,183,184],"processes","token","processes token impersonate detect","techniques","escalation","windows","attacks","via","impersonation","potato","exploitation","printspoofer","token-impersonation","seimpersonate","privilege-escalation",{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":39},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[192,170,193,107,194,195,112,32,177,196,197,198,133,111,37,173,199,38,200,175],"thread","injection","processes thread injection detect","thread-injection","nt-api","apc-injection","api","process-injection","memory"]