Skip to main content

More Info:

Wildcards in verbs, resources, or apiGroups grant overly broad permissions that violate least privilege. Replace them with explicitly scoped objects and actions.

Risk Level

Critical

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. List Roles/ClusterRoles using wildcards (run on any machine with kubectl access):
  2. For each offending Role/ClusterRole, export its definition for review/edit (example for a ClusterRole named example-role):
  3. Manually edit the exported file to replace wildcards with explicit values (run on the machine where the file is saved):
    • Replace verbs: ["*"] or verbs: - "*" with only the needed verbs, e.g.:
    • Replace resources: ["*"] or resources: - "*" with specific resources, e.g.:
    • Replace apiGroups: ["*"] or apiGroups: - "*" with required API groups, e.g.:
    • Remove any rule entries that are not actually needed. Save the file.
  4. Apply the edited Role/ClusterRole back to the cluster (run on any machine with kubectl access):
  5. If these objects are managed by GitOps or other IaC, update the source manifests similarly (edit the Role/ClusterRole definitions in your Git/IaC repo to match the changes above and run your usual deployment pipeline) to prevent them from being reverted.
  6. Verify no Roles/ClusterRoles still use wildcards (run on any machine with kubectl access):
On any machine with kubectl access:
  1. Identify ClusterRoles using wildcards
For a single ClusterRole, inspect details:
  1. Edit an existing ClusterRole to remove wildcards
For each listed ClusterRole, replace * in verbs, resources, and apiGroups with explicit entries based on actual needs.Interactive edit:
Example change (illustrative only; adjust to your requirements):
Save and exit the editor to apply.
  1. Apply a declarative manifest (preferred for GitOps/IaC-managed roles)
If your ClusterRole is managed via manifests, update the manifest and re-apply it instead of using kubectl edit.Example manifest snippet:
Apply:
Repeat for each ClusterRole using wildcards.
  1. Verification
Re-run the wildcard check to confirm there are no remaining wildcards in Roles or ClusterRoles: