Skip to main content

More Info:

The token sub-resource of service accounts can mint tokens that impersonate those accounts. Limit who can create service account tokens.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify roles/clusterroles that can create service account tokens
    • Run on: any machine with kubectl access
  2. Review which subjects are bound to those roles/clusterroles
    • For each ClusterRole name from step 1:
    • For each Role (namespace, name) from step 1:
    • Manually decide whether each subject (user/group/serviceaccount) truly needs to mint tokens.
  3. Inspect the exact permissions granted on serviceaccounts/token
    • For each role/clusterrole from step 1:
    • Confirm whether resources: ["serviceaccounts/token"] is necessary and whether verbs can be reduced or removed.
  4. Tighten or remove token-creation permissions
    • If token creation is not needed, edit and remove the serviceaccounts/token rule:
    • In the editor, delete only the rule(s) that contain resources: ["serviceaccounts/token"] (or that list it among resources), or at least remove create from verbs if you must retain other verbs.
  5. Re-assess bindings; re-scope if needed
    • Where token creation is required but too broadly granted, create a new, minimal Role/ClusterRole and bind it only to the specific service accounts/users that need it:
    • Then remove broader bindings discovered in step 2 that no longer need this access.
  6. Verify that access to serviceaccounts/token is minimized
    • Re-run the discovery from step 1 and confirm only intentionally authorized roles remain:
    • Optionally verify for a given subject whether it can still create a token:
What to look for (problematic cases):Any rules entry that includes:

What to look for (problematic cases):
  • Any entry where verbs contains create directly or via *.
  • Wide or sensitive scope, for example:
    • ClusterRole used cluster‑wide by many subjects.
    • Roles/ClusterRoles bound to:
      • system:serviceaccounts (all service accounts in a namespace or cluster).
      • system:authenticated or system:authenticated:oauth.
      • Broad user groups (e.g., corporate SSO groups) not specifically needing token minting.

What to look for (problematic cases):
  • Bindings where subjects are:
    • Group = system:authenticated, system:serviceaccounts, or large identity provider groups.
    • ServiceAccount that do not clearly need to mint tokens (generic app SAs).
    • User accounts that should not impersonate arbitrary service accounts.

What to look for (problematic cases):
  • Roles/ClusterRoles from this list that:
    • Are not strictly necessary for components that really need to mint service account tokens.
    • Are bound to broad or sensitive subjects as described above.

If this output shows no serviceaccounts/token with verbs including create (or *), or only tightly scoped, explicitly justified roles, the risk from this control has been reduced.
How to interpret the output
  • A potential problem is indicated whenever you see:
    • A ClusterRole or Role listing resources: ["serviceaccounts/token"] (or including it in the list) and verbs including "create".
    • Corresponding ClusterRoleBinding or RoleBinding sections that attach these roles to:
      • subjects with kind=User or Group representing broad human populations (e.g. system:authenticated, large SSO groups), or
      • subjects with kind=ServiceAccount that do not strictly require minting tokens for other workloads.
  • These cases should be manually reviewed; where possible, remove create on serviceaccounts/token from those roles or refactor the access to narrower, justified subjects.