More Info:
Containers with allowPrivilegeEscalation set to true can gain more privileges than their parent process. Enforce policies that restrict admission of such containers.Risk Level
HighAddress
SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify current use of
allowPrivilegeEscalationacross workloads- Run on: any machine with kubectl access
- Command:
- Save the output and review which namespaces/pods/containers currently rely on
allowPrivilegeEscalation=true.
-
Assess necessity and impact per workload
- For each listed container:
- Check its manifest:
- Review with the workload owner whether privilege escalation is truly required (e.g., needs to setuid, load kernel modules, manipulate other users’ processes).
- Classify each as: “must have”, “can be removed now”, or “needs migration work”.
- Check its manifest:
- For each listed container:
-
Design namespace-level policy using Pod Security Admission or a policy engine
- If using Pod Security Admission (recommended for OKE where available):
- Decide which namespaces need to run privileged or legacy workloads and which should be restricted.
- Example: mark “restricted” namespaces to block privilege escalation:
- If using a policy engine (e.g., Gatekeeper/Kyverno), plan a policy that denies pods where any container has
securityContext.allowPrivilegeEscalation=true, with explicit exceptions for approved namespaces or workloads.
- If using Pod Security Admission (recommended for OKE where available):
-
Implement or tighten the policy and test against current workloads
- Apply or update the chosen policy configuration (namespace labels or policy CRDs) according to your platform’s standard process.
- Before enforcing, use “audit” or “dry-run” modes where supported to detect which existing pods/Deployments would be blocked:
- For Pod Security Admission, inspect namespace warnings when applying manifests.
- For Gatekeeper/Kyverno, check policy “audit” reports or
kubectl describeon the policy object to see violations.
-
Remediate or exempt necessary workloads
- For each container classified as “can be removed now”:
- Update its Deployment/StatefulSet/Pod manifest to explicitly set:
- Apply the change:
- Update its Deployment/StatefulSet/Pod manifest to explicitly set:
- For each “must have” or “needs migration work” workload:
- Either place it in a dedicated namespace with a less-restrictive policy and clear justification, or define a narrowly scoped exception in your policy engine.
- Document the justification and planned timeline for reduction where possible.
- For each container classified as “can be removed now”:
-
Verify policy effectiveness and ongoing compliance
- Re-run the evidence command:
- Confirm that:
- “Restricted” namespaces no longer admit new pods with
allowPrivilegeEscalation=true. - Any remaining instances are explicitly approved exceptions with documented risk and controls.
- “Restricted” namespaces no longer admit new pods with
- Re-run the evidence command:
Using kubectl
Using kubectl
kube-system, kube-public, kube-node-lease, and provider-specific system namespaces). For each user namespace, inspect current pods:securityContext at both pod and container level; any explicit allowPrivilegeEscalation: true is a potential problem.Next, inspect whether the namespace has any admission policies (Pod Security Standards, PodSecurityPolicy if legacy, or custom policies) that would restrict such pods:pod-security.kubernetes.io/* labels, or they are set to a privileged mode (e.g. privileged or a custom relaxed configuration elsewhere), the namespace likely does not restrict allowPrivilegeEscalation: true.If you are using admission webhooks (e.g., Gatekeeper, Kyverno), list related resources for review:allowPrivilegeEscalation or container privilege in their names/annotations suggests the cluster may not be enforcing restrictions.Verification after any policy changes (manual, outside the scope of these commands):allowPrivilegeEscalation: true entries highlight pods that are either exempted by policy or running in namespaces without restrictive policies and need human review against your risk tolerance.Automation
Automation

