More Info:
Verifies allowPrivilegeEscalation is false on every container. It defaults to true, letting a process gain more privileges than its parent.Risk Level
HighAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify noncompliant Pods (any machine with kubectl access):
-
For a stand-alone Pod (no higher-level controller), edit its spec to set
allowPrivilegeEscalation: false(any machine with kubectl access):Under each container (andinitContainersif present), add or change:Save and exit to apply the change (the Pod may be recreated depending on your setup). -
For a Pod managed by a controller (Deployment, DaemonSet, StatefulSet, Job, CronJob), find the controller (any machine with kubectl access):
-
Edit the controller’s Pod template to set
allowPrivilegeEscalation: falsefor every container and initContainer (any machine with kubectl access). Example for a Deployment:In.spec.template.spec.containers[](and.spec.template.spec.initContainers[]if present), ensure:Save and exit; this will roll out new Pods with the updated setting. -
For controllers of other kinds, use their specific edit commands (any machine with kubectl access) and apply the same
securityContextchange:AddsecurityContext.allowPrivilegeEscalation: falseto every container and initContainer spec in the pod template. -
Verify all Pods are now compliant (any machine with kubectl access):
Confirm that either
is_compliant=trueis printed or all listed containers showallowPrivilegeEscalation=false is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:In Save and exit; Kubernetes will roll out updated Pods.If you prefer a one‑shot patch (single container example):Repeat with the appropriate resource kind/name and container index for each non‑compliant controller (StatefulSet, DaemonSet, Job, CronJob).Edit Then recreate:
- Identify non‑compliant Pods (example using the provided audit):
- For each workload controller (Deployment, StatefulSet, DaemonSet, Job, CronJob, etc.) that creates the reported Pods, patch the Pod template to set
allowPrivilegeEscalation: falseon all containers.
.spec.template.spec.containers[].securityContext (and .initContainers[] if present), ensure:- Do not edit Pods that are directly managed by controllers; instead always edit the owning controller. For standalone Pods you manage directly:
/tmp/pod-POD_NAME.yaml so each container has:- Verification (run on any machine with kubectl access):
Automation
Automation

