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 the non-compliant Pod(s) (run on any machine with kubectl access):
  2. For a Pod managed by a higher-level controller (Deployment/StatefulSet/DaemonSet, etc.), edit the controller manifest to set allowPrivilegeEscalation: false on every container (run on any machine with kubectl access; repeat per owning resource):
    In each .spec.template.spec.containers[] and .spec.template.spec.initContainers[] entry, ensure:
    If securityContext exists, just add allowPrivilegeEscalation: false under it.
  3. For a standalone Pod (no controller owner listed in step 1 output), export, modify, and re-create it (run on any machine with kubectl access; replace NAMESPACE and POD_NAME):
    Edit /tmp/pod-POD_NAME.yaml and, for every entry in spec.containers[] and spec.initContainers[], set:
    Then delete metadata.resourceVersion, metadata.uid, metadata.creationTimestamp, metadata.managedFields, and status sections from the file. Apply the fixed Pod:
  4. If your AKS cluster is managed via GitOps or IaC (e.g., manifests in a Git repo, Bicep/Terraform/ARM), update the source manifests instead of using kubectl edit, ensuring all container and initContainer specs include:
    Commit and deploy according to your existing pipeline so changes persist.
  5. Consider operational impact before saving each change: updating a Pod template in a controller triggers rollout of new Pods; standalone Pods will be deleted and recreated, briefly interrupting workloads.
  6. Verify compliance (run on any machine with kubectl access):
    Ensure the output is exactly is_compliant=true.
On any machine with kubectl access:
  1. Identify non‑compliant Pods and their owners (for context only):
  1. Patch an existing Pod’s containers to set allowPrivilegeEscalation: false (for Pods you manage directly, knowing this will recreate them via their controller, not edit live static Pods):
  1. Preferred: edit the owning workload manifest and re‑apply (Deployment, DaemonSet, StatefulSet, Job, etc.). Example for a Deployment (apply from any machine with kubectl):
  1. Verification (run on any machine with kubectl):