Overview
The RBAC role cluster-admin provides wide-ranging powers over the environment and should be used only where and when needed.
Rationale
Kubernetes provides a set of default roles where RBAC is used. Some of these roles such as cluster-admin provide wide-ranging privileges which should only be applied where necessary. Roles such as cluster-admin allow super-user access to perform any action on any resource. When used in a ClusterRoleBinding, it gives full control over every resource in the cluster and in all namespaces. When used in a RoleBinding, it gives full control over every resource in the rolebinding's namespace, including the namespace itself.
Impact
Care should be taken before removing any ClusterRoleBindings from the environment to ensure they were not required for the operation of the cluster. Specifically, modifications should not be made to ClusterRoleBindings with the system: prefix as they are required for the operation of system components.
Remediation guidance
Check each principal for the RoleBindings and ClusterRoleBindings that are attached to the cluster-admin role. Check if they need this role or if they could use a role with fewer privileges. Where possible, first bind users to a lower privileged role and then remove the ClusterRoleBinding to the cluster-admin role.
Default Value
By default, a single ClusterRoleBinding called cluster-admin is provided with the system:masters group as its principal.
References
-
https://workbench.cisecurity.org/sections/1126661/recommendations/1838588
-
https://kubernetes.io/docs/admin/authorization/rbac/#user-facing-roles
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
Kubernetes
Use admission policies, baseline cluster configuration, GitOps templates, and namespace or workload guardrails so new deployments follow the control by default.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
Kubernetes RoleBindings that use cluster-admin role
Connectors
Covered asset types
Expected check: eq []
{
clusterRoles(where: {internalName: "cluster-admin"}) {
roleBindings(where: {subjects_SOME: {name_NOT: ""}}) {
...AssetFragment
}
}
}Kubernetes ClusterRoleBindings that use cluster-admin role
Connectors
Covered asset types
Expected check: eq []
{
clusterRoles(where: {internalName: "cluster-admin"}) {
clusterRoleBindings(where: {subjects_SOME: {name_NOT: "system:masters"}}) {
...AssetFragment
}
}
}
Kubernetes