What are Linux capabilities, and why do we drop ALL?
IntermediateConceptKubernetes Security
Answer
Capabilities split root's power into about 40 units (CAP_NET_ADMIN, CAP_SYS_ADMIN, CAP_NET_RAW and so on). Container runtimes grant a default set that includes NET_RAW (ARP/DNS spoofing within the node network), CHOWN, SETUID and others most apps never use.
Dropping ALL and adding back only what is needed shrinks what an attacker can do after code execution. The common add-back is NET_BIND_SERVICE to bind ports below 1024, and even that is avoidable by listening on 8080. CAP_SYS_ADMIN is close to full root and should be treated like privileged: true.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate