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 all noncompliant Pods
    • On any machine with kubectl access:
  2. For Pods managed by higher-level controllers, patch the controller manifests
    • For each noncompliant Pod line with owner=Deployment/…, ReplicaSet/…, StatefulSet/…, or DaemonSet/…, note the owner kind, namespace, and name.
    • On any machine with kubectl access, edit the owning object (example for a Deployment; adapt kind, namespace, and name as needed):
    • In each spec.template.spec.containers[] and spec.template.spec.initContainers[] entry, ensure:
      (add securityContext if missing; if present, add or set allowPrivilegeEscalation: false).
  3. For Pods created directly (no controller owner), edit and recreate them
    • For each noncompliant Pod line with no owner= field:
    • Edit the file locally:
    • Open the file and, under spec.containers[] and spec.initContainers[] as needed, set:
    • Delete and recreate the Pod:
  4. If manifests are managed via Git/IaC, update source files
    • Locate the YAML/Helm/Kustomize definitions for the noncompliant workloads.
    • In each container and initContainer spec, set:
    • Commit and apply/sync through your normal pipeline so the change persists.
  5. Consider namespace-wide policy to prevent regression (optional but recommended)
    • On any machine with kubectl access, create or update a PodSecurity admission label on namespaces where you want to enforce restricted settings, for example:
    • Review workload compatibility before enforcing to avoid inadvertent disruptions.
  6. Verify remediation
    • After workloads are updated and reconciled, re-run the audit on any machine with kubectl access:
    • Confirm the output is is_compliant=true or that all listed containers show allowPrivilegeEscalation=false is_compliant=true.
On any machine with kubectl access:
  1. Identify non‑compliant Pods and their owners (if any):
If the Pod is controlled by a higher‑level object (Deployment, DaemonSet, Job, etc.), edit that controller; otherwise edit the Pod directly.
  1. Patch a standalone Pod to disallow privilege escalation (all containers and initContainers):
  1. Patch a Deployment so all its containers disallow privilege escalation:
Repeat similarly for other controllers, replacing deployment with daemonset, statefulset, job, or cronjob as appropriate.
  1. Verification (runs on any machine with kubectl):