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
-
List all non-system pods and identify non-compliant ones (run on any machine with kubectl access):
-
For a pod you need to fix, find its owning controller (Deployment, StatefulSet, DaemonSet, Job, etc.) (run on any machine with kubectl access):
Note the
kindandname. You will edit that controller, not the pod itself. -
Edit the owning controller manifest to set
allowPrivilegeEscalation: falseon every container (run on any machine with kubectl access):Open/tmp/${KIND}-${NAME}.yamlin an editor and, under each container (and initContainer) inspec.template.spec.containersandspec.template.spec.initContainers, ensure:IfsecurityContextexists, add only theallowPrivilegeEscalation: falseline; do not remove other fields. -
Apply the updated controller manifest so new pods are compliant (run on any machine with kubectl access):
-
(Optional but recommended) Rotate existing non-compliant pods so they are recreated from the updated controller (run on any machine with kubectl access):
-
Verification (run on any machine with kubectl access):
Confirm the output is
is_compliant=trueor that all listed containers showis_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:Apply the updated manifest:Repeat for every workload so that each Apply:You are compliant when the output is
- Identify non-compliant Pods (for context)
- Edit the owning workload manifest to set
allowPrivilegeEscalation: falseon every container.
Deployment spec snippet (applies to any workload kind: Deployment, StatefulSet, DaemonSet, Job, CronJob, etc.):spec.template.spec.containers[] and spec.template.spec.initContainers[] entry has:- For naked Pods created directly (no controller), recreate them from a manifest that sets the field:
- Verification (on any machine with kubectl access):
is_compliant=true or all listed containers show is_compliant=true.Automation
Automation

