PSP does not require dropping NET_RAW

Without a required NET_RAW or ALL capability drop in PodSecurityPolicy, workloads may retain sensitive network privileges.

Description

If a Linux workload does not need raw sockets, require NET_RAW or ALL in the legacy PSP’s requiredDropCapabilities.

Potential impact

A workload can open raw sockets if its runtime grants NET_RAW and the capability remains available.

Remediation

Check that workloads do not add back unnecessary capabilities. Kubernetes deprecated PSP in 1.21 and removed it in 1.25. On current clusters, set capabilities.drop: ["ALL"] on each container and enforce the Restricted Pod Security Standard or a policy using Gatekeeper or Kyverno.

Examples

The restricted2 policy drops only KILL. The restricted policy requires dropping ALL. Other required fields and use permissions are omitted. Because the names differ, verify that the new restriction applies to the intended workloads.

Before

yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted2
spec:
  requiredDropCapabilities:
    - KILL

After

yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted
spec:
  requiredDropCapabilities:
    - ALL

References