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
HighAddress
SecurityCompliance Standards
- CIS AKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On any machine with kubectl access, list all Roles/ClusterRoles that can create service account tokens (directly or via wildcards):
-
For each identified Role/ClusterRole, review the exact rules to confirm whether they include
serviceaccounts/tokenor overly broad patterns:Assess whethercreateonserviceaccounts/token,serviceaccounts, or*is strictly required for that role’s purpose. -
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.
-
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/tokenor wildcard rules granting it. -
Where a Role/ClusterRole has broader permissions than needed (e.g.,
resources: ["serviceaccounts", "serviceaccounts/token", "*"]orverbs: ["create", "*"]), refine it:Removeserviceaccounts/tokenand any unnecessary wildcards, preserving only the minimal set of verbs and resources truly required. -
Verify that only intended administrative roles can still create service account tokens:
Confirm that any remaining roles with
createonserviceaccounts/token(or equivalent wildcard) are bound only to trusted administrator identities.
Using kubectl
Using kubectl
resources:includesserviceaccounts/token(orserviceaccountswith*that covers sub-resources)verbs:includescreateor*- 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)
subjects:includes:- Broad groups like
system:authenticated,system:serviceaccounts,system:serviceaccounts:<namespace>, orsystem: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
- Broad groups like
- Any non-admin workload service account given
createonserviceaccounts/token - Roles bound to many service accounts in an application namespace
- Roles intended for application use (e.g.,
app-*-role) that includeserviceaccounts/tokenwithcreate
create on serviceaccounts/token.Automation
Automation

