Skip to main content

More Info:

Verifies no ServiceAccount is bound to the cluster-admin ClusterRole. Such a binding hands full cluster control to any workload using that account.

Risk Level

Critical

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List all ClusterRoleBindings that bind cluster-admin to any ServiceAccount (run on any machine with kubectl access):
  2. For each violating ServiceAccount, determine the minimal permissions it actually needs (run on any machine with kubectl access):
    • Inspect its namespace and associated workloads:
    • Review application requirements (deployment manifests, documentation, and logs for authorization errors).
  3. Create a narrowly scoped Role or ClusterRole that grants only the required verbs and resources (run on any machine with kubectl access, then apply to the cluster):
    • Example namespaced Role (adjust namespace, resources, verbs):
    • Example RoleBinding to attach it to the ServiceAccount:
  4. After confirming the workload functions correctly with the new, least-privilege Role/RoleBinding (monitor pod logs and behavior), identify the offending ClusterRoleBinding names (run on any machine with kubectl access):
  5. Delete each ClusterRoleBinding that binds any ServiceAccount to cluster-admin (run on any machine with kubectl access):
  6. Verify no ServiceAccount is bound to cluster-admin (run on any machine with kubectl access):
    The output must be exactly:
On any machine with kubectl access:
  1. Identify violating ClusterRoleBindings and affected ServiceAccounts
  1. For each ClusterRoleBinding that binds a ServiceAccount to cluster-admin, design and apply a narrowly-scoped replacement (example only; adjust rules to what the workload actually needs):
Bind the ServiceAccount to the new Role (replace NAMESPACE and SA_NAME appropriately):
  1. Delete the insecure ClusterRoleBinding(s)
Replace BINDING_NAME with each offending ClusterRoleBinding name:
  1. Verification
Run the benchmark audit command exactly: