Medium

Ensure container is not privileged

Security & Compliance
No items found.
Description

When a container is privileged, it runs with access to all the system resources on the host, including the kernel, which can be a security risk. An attacker who gains control of a privileged container can potentially compromise the entire host system. Therefore, it is recommended to run containers with the least amount of privileges necessary. Ensuring that containers are not privileged involves restricting their access to system resources and avoiding granting them root privileges. This can be achieved by running the containers as non-root users and dropping capabilities that are not necessary for the container's operation.

Remediation

To ensure that the container is not privileged, follow these steps:

  1. Update the Dockerfile or the container's configuration to remove any privileged settings.
  2. Run the container with the --privileged=false option to ensure that it does not have privileged access.
  3. Set up user namespaces and run the container as a non-root user to further restrict access.
  4. Audit the container's permissions and processes to ensure that they are limited to what is necessary for the container to function.
  5. Regularly review and update the container's configuration to ensure that it remains non-privileged.

Enforced Resources
Note: Remediation steps provided by Lightlytics are meant to be suggestions and guidelines only. It is crucial to thoroughly verify and test any remediation steps before applying them to production environments. Each organization's infrastructure and security needs may differ, and blindly applying suggested remediation steps without proper testing could potentially cause unforeseen issues or vulnerabilities. Therefore, it is strongly recommended that you validate and customize any remediation steps to meet your organization's specific requirements and ensure that they align with your security policies and best practices.