Skip to main content

Impact & Risk Analysis

  • Severity: Medium
  • CIS Benchmark: CIS 5.2.6
  • Impact: Privilege Escalation via Setuid. If allowPrivilegeEscalation is set to true (which is the default), a process inside the container can gain more privileges than its parent process. This is typically achieved via setuid binaries (like sudo, ping, or passwd). If an attacker exploits a vulnerability in a setuid binary, they can escalate their privileges to root effectively within the container.

Common Misconfiguration

Omitting the securityContext entirely. By default, Kubernetes and Docker allow privilege escalation. You must explicitly disable it to be secure.

Vulnerable Example

Secure Example

Audit Procedure

Run the following command to check the security context of all pods:
  • Analyze: Look for allowPrivilegeEscalation: false.
  • Fail: If the output shows true or if the field is missing (which implies true).

Remediation

Add policies to each namespace in the cluster to restrict the admission of containers that allow privilege escalation. Using Pod Security Admission: Apply the restricted profile. The restricted profile requires allowPrivilegeEscalation: false. (Note: The baseline profile allows it).
Workload Configuration: Update your Deployment/Pod manifests to explicitly set the flag: