Skip to main content

lacework-global-345

4.2.9 Minimize the admission of containers with capabilities assigned (Manual)

Profile Applicability

• Level 1

Description

Do not generally permit containers with capabilities

Rationale

Containers run with a default set of capabilities as assigned by the Container Runtime. Capabilities are parts of the rights generally granted on a Linux system to the root user.

In many cases applications running in containers do not require any capabilities to operate, so from the perspective of the principal of least privilege use of capabilities should be minimized.

Impact

Pods with containers require capabilities to operate will not be permitted.

Audit

Get the set of PSPs with the following command:

kubectl get psp

For each PSP, check whether capabilities have been forbidden:

kubectl get psp <name> -o=jsonpath='{.spec.requiredDropCapabilities}'

Remediation

Review the use of capabilities in applications running on your cluster. Where a namespace contains applications which do not require any Linux capabilities to operate consider adding a PSP which forbids the admission of containers which do not drop all capabilities.

References

https://kubernetes.io/docs/concepts/policy/pod-security-policy/#enabling-pod-security-policies
https://www.nccgroup.trust/uk/our-research/abusing-privileged-and-unprivileged-linux-containers/