Impact & Risk Analysis
- Severity: Medium (Level 2 - Defense in Depth)
- CIS Benchmark: CIS 5.2.7
- Impact: Container Breakout. Containers running as root (UID 0), even if restricted by namespaces, present a higher risk. If a vulnerability exists in the container runtime or kernel, a process already running as root has a much easier path to escaping the container and gaining control of the host than a process running as an unprivileged user.
Common Misconfiguration
Deploying containers using default images (likenode:latest or nginx:latest) without specifying a user. By default, most Docker images run as root unless the Dockerfile explicitly creates a user or the Kubernetes manifest overrides it.
Vulnerable Example
Secure Example
Audit Procedure
List the policies in use for each namespace and audit the pods to ensure they are not running as root. Check Running Pods:- Pass: If the label
pod-security.kubernetes.io/enforce=restrictedis present. - Fail: If the label is
baselineorprivileged(both allow running as root).
Remediation
- Update Application Manifests: Modify your Deployment YAMLs to include
runAsNonRoot: trueand specify arunAsUser> 0. - Enforce Policy: Apply the restricted Pod Security Standard to your namespaces.

