Skip to main content

More Info:

Verifies allowPrivilegeEscalation is false on every container. It defaults to true, letting a process gain more privileges than its parent.

Risk Level

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify noncompliant Pods (any machine with kubectl access):
  2. For a stand-alone Pod (no higher-level controller), edit its spec to set allowPrivilegeEscalation: false (any machine with kubectl access):
    Under each container (and initContainers if present), add or change:
    Save and exit to apply the change (the Pod may be recreated depending on your setup).
  3. For a Pod managed by a controller (Deployment, DaemonSet, StatefulSet, Job, CronJob), find the controller (any machine with kubectl access):
  4. Edit the controller’s Pod template to set allowPrivilegeEscalation: false for 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.
  5. For controllers of other kinds, use their specific edit commands (any machine with kubectl access) and apply the same securityContext change:
    Add securityContext.allowPrivilegeEscalation: false to every container and initContainer spec in the pod template.
  6. Verify all Pods are now compliant (any machine with kubectl access):
    Confirm that either is_compliant=true is printed or all listed containers show allowPrivilegeEscalation=false is_compliant=true.
On any machine with kubectl access:
  1. Identify non‑compliant Pods (example using the provided audit):
  1. For each workload controller (Deployment, StatefulSet, DaemonSet, Job, CronJob, etc.) that creates the reported Pods, patch the Pod template to set allowPrivilegeEscalation: false on all containers.
Example: Deployment
In .spec.template.spec.containers[].securityContext (and .initContainers[] if present), ensure:
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).
  1. Do not edit Pods that are directly managed by controllers; instead always edit the owning controller. For standalone Pods you manage directly:
Edit /tmp/pod-POD_NAME.yaml so each container has:
Then recreate:
  1. Verification (run on any machine with kubectl access):