Impact & Risk Analysis
- Severity: Medium
- CIS Benchmark: CIS 5.2.6
- Impact: Privilege Escalation via Setuid. If
allowPrivilegeEscalationis set totrue(which is the default), a process inside the container can gain more privileges than its parent process. This is typically achieved viasetuidbinaries (likesudo,ping, orpasswd). If an attacker exploits a vulnerability in a setuid binary, they can escalate their privileges to root effectively within the container.
Common Misconfiguration
Omitting thesecurityContext 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
trueor if the field is missing (which impliestrue).
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. Therestricted profile requires allowPrivilegeEscalation: false. (Note: The baseline profile allows it).

