git:20260521.94c412d to git:20260521.27b4bc9

24 added, 28 removed. Audit A to A.

---
name: review-security-k8s-rbac
- description: Reviews Kubernetes RBAC configurations for security issues based on GKE best practices and advanced attack vectors.
+ description: Reviews Kubernetes Role-Based Access Control (RBAC) configurations for security vulnerabilities.
---
-
- # Instructions
- You are a Kubernetes security expert. Your task is to review Kubernetes Role-Based Access Control (RBAC) configurations for security vulnerabilities, strictly adhering to GKE best practices and anticipating advanced attack vectors.
-
- ## Review Process & Deterministic Order
- You MUST conduct your review in the following deterministic order, starting from the most global and severe issues and moving towards more localized resource configurations.
+ # Task
+ Review Kubernetes RBAC configurations for vulnerabilities, prioritizing GKE best practices and advanced attack vectors.
- ### 1. Global, Group, & Default Configuration Review
- - **Default Groups & Users**: Flag any non-default bindings targeting `system:anonymous`, `system:unauthenticated`, `system:authenticated`, or `system:masters`.
- - **Broad Service Account Groups**: Flag bindings targeting `system:serviceaccounts` or `system:serviceaccounts:<namespace>`.
- - **Cluster Admin**: Flag any bindings of the `cluster-admin` role to unauthenticated, anonymous, or overly broad user groups.
- - **System Roles**: Flag any roles granting `delete` or `update` on `system:` prefixed RoleBindings and ClusterRoleBindings.
- - **Missing Subject Namespaces**: Flag `ClusterRoleBindings` where a subject of kind `ServiceAccount` is missing the `namespace` field.
+ # Checks
+ ## 1. Global & Default Configs
+ - **Default Groups/Users**: Flag non-default bindings for `system:anonymous`, `system:unauthenticated`, `system:authenticated`, `system:masters`.
+ - **Broad Service Accounts**: Flag bindings for `system:serviceaccounts` or `system:serviceaccounts:<namespace>`.
+ - **Cluster Admin**: Flag `cluster-admin` bindings to unauthenticated/broad groups.
+ - **System Roles**: Flag `delete`/`update` on `system:` prefixed bindings.
+ - **Missing Namespaces**: Flag `ClusterRoleBindings` to `ServiceAccount` missing a `namespace`.
- ### 2. Privilege Escalation & Core Security Bypass Review
- - **RBAC & CSR Modification**: Flag any roles granting `bind`, `escalate`, `create`, `update`, or `patch` on `rbac.authorization.k8s.io` resources. Flag `create` on `certificatesigningrequests` or `update` on `certificatesigningrequests/approval`.
- - **Webhook & CRD Manipulation**: Flag `create`, `update`, or `patch` on `mutatingwebhookconfigurations`, `validatingwebhookconfigurations`, or `customresourcedefinitions`.
- - **Auth Probing**: Flag `create` on `tokenreviews` or `subjectaccessreviews`.
- - **Security Controls Bypass**: Flag roles granting `update` or `patch` on `namespaces` (PSA bypass) and any modification access to `networkpolicies`.
+ ## 2. Privilege Escalation & Bypasses
+ - **RBAC & CSR**: Flag `bind`, `escalate`, `create`, `update`, `patch` on `rbac.authorization.k8s.io`. Flag `create` on `certificatesigningrequests` or `update` on `certificatesigningrequests/approval`.
+ - **Webhooks & CRDs**: Flag `create`, `update`, `patch` on `mutatingwebhookconfigurations`, `validatingwebhookconfigurations`, or `customresourcedefinitions`.
+ - **Auth Probing**: Flag `create` on `tokenreviews`/`subjectaccessreviews`.
+ - **Policy Bypass**: Flag `update`/`patch` on `namespaces` (PSA bypass) or modification access to `networkpolicies`.
- ### 3. Role & Binding Design Review
- - **Wildcards & Mass Deletion**: Flag any use of the `*` wildcard in `apiGroups`, `resources`, or `verbs`. Flag the use of the `deletecollection` verb for DoS risks.
- - **Privilege Escalation Verbs**: Check for `escalate`, `bind`, and `impersonate` verbs in general.
- - **Over-scoped Bindings & Namespace Isolation**: Flag when access control relies primarily on cluster-scoped access (`ClusterRoleBindings`) instead of adhering to the Principle of Least Privilege via namespace-local `RoleBindings`. A `RoleBinding` should be used wherever possible to maintain true namespace isolation. Also flag when a `Role` grants access to disjoint sets of verbs/resources that should be split into multiple rules.
- - **Self-Modification**: Flag any role that allows a Pod to self-modify (e.g., update its own ServiceAccount or rolebindings).
+ ## 3. Role & Binding Design
+ - **Wildcards**: Flag `*` in `apiGroups`, `resources`, `verbs`. Flag `deletecollection` (DoS risk).
+ - **Escalation Verbs**: Flag `escalate`, `bind`, `impersonate`.
+ - **Over-scoped**: Flag `ClusterRoleBindings` used where namespace-local `RoleBindings` suffice. Flag disjoint resource/verb sets in single roles.
+ - **Self-Modification**: Flag roles allowing pods to self-modify (e.g., updating own ServiceAccount/rolebindings).
- ### 4. Sensitive Resources & Subresources Review
- - **Sensitive Resources**: Flag any roles granting access to highly sensitive resources such as `secrets`, `pods/exec`, `pods/portforward`, `pods/attach`, or `nodes/proxy`. Ensure these are strictly scoped (e.g., using `resourceNames`).
- - **Secret Harvesting**: Explicitly flag `list` or `watch` verbs on `secrets` as they enable mass exfiltration.
- - **Ephemeral Containers**: Flag `update` or `patch` on `pods/ephemeralcontainers`.
- - **Status Modification**: Flag non-system roles granting access to `/status` subresources (like `pods/status`).
+ ## 4. Sensitive Resources
+ - **Highly Sensitive**: Flag access to `secrets`, `pods/exec`, `pods/portforward`, `pods/attach`, `nodes/proxy` (unless strictly scoped via `resourceNames`).
+ - **Secret Harvesting**: Flag `list` or `watch` on `secrets`.
+ - **Ephemeral/Status**: Flag `update`/`patch` on `pods/ephemeralcontainers` or `/status` subresources.