Skip to main content

More Info:

Wildcards in RBAC rules grant access to all resources or verbs, effectively broad privilege. Replace them with explicit resources and actions.

Risk Level

Critical

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify ClusterRoles using wildcards (any machine with kubectl access)
  2. For each non-system ClusterRole using wildcards, export its definition for review (any machine with kubectl access)
  3. Manually analyze required permissions and replace wildcards (manual review)
    • Consult application/team owners to determine the minimum set of:
      • apiGroups actually needed (e.g. "", apps, batch, rbac.authorization.k8s.io)
      • resources actually used (e.g. pods, deployments, secrets, configmaps, cronjobs)
      • verbs actually required (e.g. get, list, watch, create, update, patch, delete)
    • In each exported YAML under .rules:
      • Replace apiGroups: ["*"] with an explicit list of required API groups.
      • Replace resources: ["*"] with an explicit list of required resources.
      • Replace verbs: ["*"] with an explicit list of required verbs.
    • Do not modify Kubernetes-critical or provider-managed ClusterRoles (e.g. those starting with system:, eks:, gke-, azure-, etc.) unless you fully understand the impact.
  4. Apply the edited ClusterRole definitions back to the cluster (any machine with kubectl access)
  5. If necessary, split very broad ClusterRoles into multiple least-privilege roles (any machine with kubectl access)
    • When different consumers need different subsets of permissions, create separate ClusterRoles:
    • Update existing ClusterRoleBindings or RoleBindings to point to the new, narrower ClusterRoles:
  6. Verify no ClusterRoles still use wildcards (any machine with kubectl access)
On any machine with kubectl access:
  1. Identify noncompliant ClusterRoles (those with "*" in rules):
  1. For each noncompliant ClusterRole, export the manifest for editing:
  1. Edit /tmp/clusterrole-<CLUSTERROLE_NAME>.yaml and replace wildcard entries with explicit resources/verbs. For example, change:
to something like (adjust to the minimal required permissions):
Ensure no ["*"] remains in apiGroups, resources, verbs, resourceNames, or nonResourceURLs.
  1. Apply the updated ClusterRole:
Repeat steps 2–4 for each affected ClusterRole.
  1. Verification (rerun check for ClusterRoles):