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
MediumAddress
SecurityCompliance 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
Remediation
Manual Steps
Manual Steps
-
Identify default service accounts and workloads using them (run on any machine with kubectl access)
-
Create explicit service accounts to replace
defaultwhere needed (run on any machine with kubectl access; repeat per namespace) -
Update pods/workloads to stop using the
defaultServiceAccount (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.
- For Deployments, StatefulSets, DaemonSets, Jobs, etc., edit the manifest and set
-
Disable token automount on each
defaultServiceAccount (run on any machine with kubectl access; repeat per namespace that has an active default SA) -
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
defaultor no SA set), edit and set:
- Under
spec.template.spec, add:
- For any pod spec that must explicitly ensure no token automount (and still uses
-
Verify remediation (run on any machine with kubectl access)
Using kubectl
Using kubectl
Using kubectl
-
Identify default ServiceAccounts with token automount enabled
Run on: any machine with kubectl access -
Disable token automount on each default ServiceAccount
Replace<NAMESPACE>with each namespace from the previous command.
Run on: any machine with kubectl accessTo apply this for all current namespaces in one go (requires bash + jq): -
Ensure workloads do not use the default ServiceAccount
For each deployment/statefulset/cronjob/etc. that currently usesserviceAccountName: default, update its manifest to use an explicit ServiceAccount, for example: Example ServiceAccount manifest (apply per namespace as needed):Example Deployment manifest snippet:Apply: -
Verification
Run on: any machine with kubectl access
Automation
Automation

