Skip to main content

More Info:

The default service account should not be used to ensure that rights granted to applications can be more easily audited and reviewed.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CIS GKE
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Manual Steps

  1. Identify default service accounts and workloads using them (run on any machine with kubectl access)
  2. Create explicit service accounts to replace default where needed (run on any machine with kubectl access; repeat per namespace)
  3. Update pods/workloads to stop using the default ServiceAccount (run on any machine with kubectl access; repeat per workload)
    • For Deployments, StatefulSets, DaemonSets, Jobs, etc., edit the manifest and set spec.template.spec.serviceAccountName:
    • In the editor, under spec.template.spec, add or change:
    • Save and exit to trigger a rollout using the new service account.
  4. Disable token automount on each default ServiceAccount (run on any machine with kubectl access; repeat per namespace that has an active default SA)
  5. Optionally enforce pod-level override for any remaining pods (run on any machine with kubectl access; repeat where needed)
    • For any pod spec that must explicitly ensure no token automount (and still uses default or no SA set), edit and set:
    • Under spec.template.spec, add:
  6. Verify remediation (run on any machine with kubectl access)

Using kubectl

  1. Identify default ServiceAccounts with token automount enabled
    Run on: any machine with kubectl access
  2. Disable token automount on each default ServiceAccount
    Replace <NAMESPACE> with each namespace from the previous command.
    Run on: any machine with kubectl access
    To apply this for all current namespaces in one go (requires bash + jq):
  3. Ensure workloads do not use the default ServiceAccount
    For each deployment/statefulset/cronjob/etc. that currently uses serviceAccountName: default, update its manifest to use an explicit ServiceAccount, for example:
    Example ServiceAccount manifest (apply per namespace as needed):
    Example Deployment manifest snippet:
    Apply:
  4. Verification
    Run on: any machine with kubectl access

Additional Reading: