Skip to main content

More Info:

Verifies that the API server —anonymous-auth argument is set to false. Allowing anonymous requests lets unauthenticated users access the API and is a critical exposure.

Risk Level

Critical

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify how users currently authenticate
    • On any machine with kubectl access, list all ClusterRoleBinding and RoleBinding objects to see which subjects (users, groups, service accounts) have access:
    • Review these files for kind: ServiceAccount used as long‑lived “users” (e.g., bound to broad cluster roles like cluster-admin or used outside pods).
  2. Locate and review OIDC (or other user auth) configuration
    • On every control plane node, inspect the API server static pod manifest to see what authentication mechanisms are configured:
    • In the command: section, look for flags such as --oidc-issuer-url, --oidc-client-id, --oidc-username-claim, --oidc-groups-claim, or webhook/token file auth flags.
    • If no non–service-account user auth mechanism is configured, plan an OIDC or other supported auth integration before removing any service-account-based user access.
  3. Inventory service accounts used as “users”
    • On any machine with kubectl access, list all service accounts and their tokens/secrets:
    • Correlate service accounts that:
      • Are referenced in out-of-cluster automation, scripts, or CI/CD as bearer tokens.
      • Have powerful bindings (e.g., cluster-admin) from step 1.
    • Document which external systems rely on these tokens.
  4. Plan and, if appropriate, migrate those “user” identities to OIDC (or another user auth)
    • Work with your identity team to create proper user or group identities in your IdP and configure Kubernetes API server OIDC flags in /etc/kubernetes/manifests/kube-apiserver.yaml (or equivalent mechanism) according to your platform’s guidance.
    • For each external system identified in step 3, update its configuration to use OIDC (or other non–service-account) auth instead of embedding a service account token.
    • Apply any manifest changes to /etc/kubernetes/manifests/kube-apiserver.yaml; be aware that editing this file will restart the API server pod on that control plane node.
  5. Tighten or remove service account–based user access
    • Once alternate auth is working, on any machine with kubectl access, remove or reduce broad RBAC bindings that treat service accounts as users (example for a specific binding):
    • Optionally delete no-longer-needed service accounts and their secrets:
    • Ensure remaining service accounts are only used by in-cluster workloads and have least-privilege roles.
  6. Verify current state and document residual exceptions
    • Re-run evidence collection to confirm that no service accounts are bound as generic user identities:
    • For any remaining intentional uses (e.g., machine-to-machine automation that cannot yet use OIDC), document the justification, scope, and planned remediation timeline, as this check is inherently manual and risk-based.
kubectl cannot change API server process flags or the static pod manifest at /etc/kubernetes/manifests/kube-apiserver.yaml on control plane nodes. To address this finding, make the change directly on each control plane node’s host configuration as described in the Manual Steps section.