Skip to main content

More Info:

Do not generally permit containers to be run with the allowPrivilegeEscalation flag set to true. Allowing this right can lead to a process running a container getting more rights than it started with.

Risk Level

High

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. List all pods with allowPrivilegeEscalation=true (any machine with kubectl access)
  2. Decide which workloads are allowed an exception (manual review)
    For each listed pod/container:
    • Determine if it is a user workload vs. a system/infra component.
    • For user workloads, strongly prefer no privilege escalation.
    • Only allow escalation if there is a documented, reviewed need (e.g., a process that must gain extra Linux capabilities after start).
    • For system/infra workloads, prefer to run them in dedicated namespaces with a clearly documented exception policy.
  3. Create or update a baseline policy in each user-workload namespace (any machine with kubectl access)
    Example using a PodSecurityPolicy-style Kyverno policy (adjust to your chosen admission controller/tooling):
    Replace user-namespace-1, user-namespace-2 with the actual namespaces that host user workloads. If you use PSA/PSP, configure the equivalent “restricted” behavior that forbids privilege escalation.
  4. Update existing workload manifests to disable privilege escalation (any machine with kubectl access)
    For each non-exempt Deployment/StatefulSet/DaemonSet/Job in user namespaces, patch containers to set allowPrivilegeEscalation: false:
    Adjust namespace, deployment, container index, and, if needed, merge with any existing securityContext instead of overwriting it.
  5. Handle justified exceptions explicitly (any machine with kubectl access)
    • For workloads you decided must keep allowPrivilegeEscalation: true, place them in dedicated namespaces and/or label them, and update your admission policy to match on those namespaces/labels and allow the setting.
    • Document each exception: purpose, owner, review date, and risk acceptance.
  6. Verify no pods are running with allowPrivilegeEscalation=true (except approved exceptions) (any machine with kubectl access)
    Investigate any is_compliant: false entries and ensure they are either corrected or explicitly approved exceptions.

Additional Reading: