Skip to main content

More Info:

Access to create the token sub-resource of ServiceAccounts can be used to obtain persistent unauthorized access to the cluster. It should be limited to trusted administrators only.

Risk Level

High

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. On any machine with kubectl access, list all Roles/ClusterRoles that can create service account tokens (directly or via wildcards):
  2. For each identified Role/ClusterRole, review the exact rules to confirm whether they include serviceaccounts/token or overly broad patterns:
    Assess whether create on serviceaccounts/token, serviceaccounts, or * is strictly required for that role’s purpose.
  3. Identify who is actually getting this permission by listing RoleBindings/ClusterRoleBindings that reference each Role/ClusterRole:
    Decide whether each subject (user, group, or service account) is a trusted administrator that should retain this ability.
  4. For non-administrative or unnecessary subjects, remove or adjust bindings so they no longer inherit token creation:
    When editing, ensure the referenced Role/ClusterRole does not include serviceaccounts/token or wildcard rules granting it.
  5. Where a Role/ClusterRole has broader permissions than needed (e.g., resources: ["serviceaccounts", "serviceaccounts/token", "*"] or verbs: ["create", "*"]), refine it:
    Remove serviceaccounts/token and any unnecessary wildcards, preserving only the minimal set of verbs and resources truly required.
  6. Verify that only intended administrative roles can still create service account tokens:
    Confirm that any remaining roles with create on serviceaccounts/token (or equivalent wildcard) are bound only to trusted administrator identities.
Problem indication: Any returned ClusterRole is capable of creating service account tokens. Every such role must be reviewed to ensure it is intended only for trusted administrators.
What to look for as problematic:
  • resources: includes serviceaccounts/token (or serviceaccounts with * that covers sub-resources)
  • verbs: includes create or *
  • Role name/description does not clearly indicate “admin” or privileged use
  • Rules are overly broad, e.g.:
    • resources: ["*"] or ["serviceaccounts", "serviceaccounts/token"]
    • verbs: ["*"] or includes unrelated high-privilege verbs (impersonate, bind, escalate)
Problem indication:
  • subjects: includes:
    • Broad groups like system:authenticated, system:serviceaccounts, system:serviceaccounts:<namespace>, or system:masters-equivalents where that group is not strictly controlled
    • Generic or many service accounts, instead of a single, well-known admin account
    • External identities (OIDC, AAD, etc.) mapped from large user groups
Problem indication (namespace Roles/RoleBindings):
  • Any non-admin workload service account given create on serviceaccounts/token
  • Roles bound to many service accounts in an application namespace
  • Roles intended for application use (e.g., app-*-role) that include serviceaccounts/token with create
Healthy state: Only tightly controlled, clearly administrative roles (and their bindings) appear in this output. Any role used by regular workloads or broad groups should not have create on serviceaccounts/token.