Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.5
- Impact: Full Host Compromise. Using the
--privilegedflag provides all Linux kernel capabilities to the container and lifts all limitations enforced by the device cgroup controller. As a consequence, the container has most of the rights of the underlying host, allowing a compromised container to potentially gain root access to the server.
Common Misconfiguration
Running containers with the--privileged flag enabled. This is often done to allow for specific use cases (like running Docker-in-Docker) or to lazily bypass permission errors, but it effectively disables the security isolation between the container and the host.
Vulnerable Example
Secure Example
Audit Procedure
Run the command below to inspect the privileged status of all containers:- Result: The command should return
Privileged=falsefor each container instance. - Fail: If any container returns
Privileged=true.
Remediation
You should not run containers with the--privileged flag. If your application requires specific permissions (like binding to a port), grant only those specific Linux capabilities using --cap-add instead of granting full privileged access.
