Kubernetes check
Container allows privilege escalation
Trigger condition
A regular, init, or live ephemeral container's securityContext.allowPrivilegeEscalation is explicitly set to true, or is omitted (which Kubernetes itself defaults to true). An explicit false is not flagged. This is purely a container-level field -- there is no Pod-level default -- and it is evaluated independently of K8S-SEC-004's runAsUser/runAsNonRoot logic, so a non-root startup UID does not suppress this finding. A Pod or Deployment template explicitly declaring spec.os.name as windows is skipped; an unspecified OS is evaluated using the same Linux rules as K8S-SEC-004.
Evidence
States the container's type and name, and whether allowPrivilegeEscalation was explicitly set to true or was omitted and defaults to true.
Impact
allowPrivilegeEscalation permits a process in the container to gain more privileges than its parent process -- for example, by executing a setuid or setgid binary. This is a narrower, distinct setting from securityContext.privileged and from an added CAP_SYS_ADMIN capability, both of which require their own separate attention and are not evaluated by this check.
Recommendation
Set allowPrivilegeEscalation to false, after checking that the workload does not depend on gaining privileges this way (e.g. a setuid binary it actually relies on). allowPrivilegeEscalation: false is incompatible with privileged: true or an added SYS_ADMIN capability (CAP_SYS_ADMIN); if either is configured, first verify the workload can run without it, then remove the applicable setting before setting allowPrivilegeEscalation: false. For a Deployment-managed container, make the change in the Deployment's own Pod template and roll out the change. For a Pod with no verified owning Deployment, if a controller manages it (e.g. a DaemonSet or StatefulSet), make the change in that workload's own source configuration and follow its normal update process; if the Pod is standalone, make the change in its own source manifest and recreate it -- either way, a running Pod's container spec cannot be edited in place, so check workload availability before it is replaced. When a live Pod's container allows privilege escalation but its Deployment template's own matching container does not, check the Deployment's rollout status (an older replica may predate a template correction) and whether an admission-time mutation (e.g. a mutating webhook) altered that Pod independently of its template -- investigate through the owning controller rather than editing the Pod directly. For an ephemeral container, apply this corrected configuration to any future debug container attached to the Pod; clearing this existing one requires replacing the Pod itself, through the Eviction API or a normal Deployment rollout, after checking available capacity and any PodDisruptionBudget.
Important limitations
This check evaluates only securityContext.allowPrivilegeEscalation. It does not detect equivalent or partial escalation paths achieved through other means, such as securityContext.privileged or an added CAP_SYS_ADMIN capability, both of which require their own separate attention and are not evaluated here.