More Info:
Verifies automountServiceAccountToken is false for pods that do not call the Kubernetes API. A mounted token is a ready-made credential for an attacker who lands in the pod.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify noncompliant pods
- Run on: any machine with kubectl access
-
For a standalone Pod: capture the manifest
- Run on: any machine with kubectl access
Replace NAMESPACE and POD_NAME with values from step 1:
- Run on: any machine with kubectl access
-
Edit the pod manifest to disable token automount
- Run on: any machine with kubectl access
- Open the file and add or update the field under
spec:
- If
automountServiceAccountTokenalready exists underspec:, edit it so it reads:
-
Recreate the pod with the updated manifest
- Run on: any machine with kubectl access
-
For controller-managed workloads (e.g., Deployment, DaemonSet, Job): patch the controller instead of the pod
- Run on: any machine with kubectl access
- Example for a Deployment; adjust KIND, NAME, and NAMESPACE based on the
owner=from step 1:
- The controller will automatically recreate pods with the new setting.
-
Verify compliance
- Run on: any machine with kubectl access
Using kubectl
Using kubectl
On any machine with kubectl access to the OKE cluster:Edit Apply the updated manifest:Kubernetes will recreate the pods managed by this Deployment with Edit Delete and recreate the pod:Edit Apply:
-
Identify a non‑compliant pod and its owner (from the audit output), for example:
- Namespace:
app-namespace - Pod name:
web-7c8b4f9d9b-xj9lt - Owner:
Deployment/app-namespace/web
- Namespace:
-
Export the owning workload manifest, edit it locally, and re‑apply (pod spec fields like
automountServiceAccountTokenmust be set on the controller, not on the individual pod):
web-deploy.yaml and in spec.template.spec add (or change) this field:automountServiceAccountToken: false. Repeat this pattern for other controller types (StatefulSet, DaemonSet, Job, CronJob) by adjusting the kind in the kubectl get command and editing the same spec.template.spec section.- If the pod is created directly (no controller ownerReference), edit the pod spec and re‑create it:
web-standalone-pod.yaml:- Optional: set this at the ServiceAccount level instead of each pod, if all pods using it do not need API access:
web-sa.yaml:- Verification (rerun the audit command):
Automation
Automation

