Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.2.2
- Impact: Full Host Compromise. Privileged containers have access to all Linux Kernel capabilities and devices. A container running with
privileged: trueeffectively bypasses container isolation, allowing it to do almost everything the host can do (e.g., loading kernel modules, accessing host hardware, modifying host files).
Common Misconfiguration
Developers often setprivileged: true to bypass permission errors quickly (e.g., for Docker-in-Docker builds or hardware access) without realizing it grants root-level access to the underlying node.
Vulnerable Example
Secure Example
Audit Procedure
Run the following command to inventory all privileged usage on the cluster:- Analyze: The output shows the security context for every pod.
- Fail: If you see
{"privileged":true}in the output for any non-system pod (likecalico-nodeorkube-proxy, which may legitimately require it).
Remediation
Add policies to each namespace in the cluster to restrict the admission of privileged containers. Using Pod Security Admission (Native K8s): Apply thebaseline or restricted profile to your namespaces. The baseline profile forbids privileged containers.
ConstraintTemplate or ClusterPolicy that specifically blocks securityContext.privileged: true.
