Skip to main content

More Info:

The ability to create the token sub-resource of service accounts lets subjects mint credentials for other identities. Restrict token creation access to trusted administrators only.

Risk Level

High

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify all roles with serviceaccounts/token create permission
    Run on any machine with kubectl access:
    Save the output as your initial inventory of roles to review.
  2. List all bindings that grant those roles
    Using the role names from step 1, run (replace ROLE_NAME and ROLE_KIND):
    This shows which users, groups, and service accounts can create tokens.
  3. Decide which subjects truly need token-creation capability
    For each subject from step 2, determine:
    • Is this a trusted admin identity (e.g., platform SRE group)?
    • Is token minting required for its function (e.g., CI system creating short-lived tokens)?
    • Could it instead use normal service account mounting or pre-created secrets?
      Mark subjects as “required”, “over-privileged”, or “unknown; investigate owner”.
  4. Restrict or remove access for over-privileged subjects
    For any binding you decide should not have this right:
    • If the role is used only for token creation, delete the binding:
    • If the role has other needed permissions, clone and edit it to remove the serviceaccounts/token create rule, then re-bind:
    Ensure only trusted admin identities remain bound to roles that still include this permission.
  5. Optionally create a dedicated, tightly scoped admin role for token creation
    Run if you need explicit admin-only token creation capability:
    Bind this only to a small, trusted admin group:
  6. Re-verify effective access
    Re-run the discovery from step 1 and 2 to confirm only intended admin identities retain create on serviceaccounts/token:
    Confirm no non-admin or unintended subjects appear in these results.
How to read this:
  • Output columns: KIND NAME NAMESPACE
  • Any ClusterRole or Role listed here allows creating service account tokens.
  • ClusterRole entries are cluster-wide; impact is larger than namespace-scoped Role.
  • A problem exists if:
    • The role name is clearly meant for applications or CI/CD (not admin/ops), or
    • You see very generic roles (e.g. edit, admin, *) granting this, or
    • There are many such roles without a clear administrative purpose.

Focus on:
  • resources: ["serviceaccounts/token"]
  • verbs containing create or *
A problem exists if non-admin or broadly used roles (bound to many subjects) contain this rule.
How to read this:
  • Columns: ROLEBINDING-NAME SUBJECT-KIND SUBJECT-NAME SUBJECT-NAMESPACE
  • Problematic patterns:
    • User or Group subjects representing general developer groups, CI groups, or broad SSO groups.
    • ServiceAccount subjects for application workloads, not admin/ops.
    • Many subjects bound to the same token-creating role (widespread privilege).

Cross-check:
  • For each binding where the referenced role/clusterrole was found in step 1, ask:
    • Is this subject a trusted administrator identity?
    • Does this subject truly need to mint tokens for other service accounts?
If the answer is “no” or unclear, that binding is likely a problem and should be considered for restriction or removal during manual remediation.