Description
Linux containers may retain NET_RAW when their drop list omits it. Check whether the application needs raw sockets.
Potential impact
A compromised application with NET_RAW can use raw sockets to send or manipulate network packets.
Remediation
Under the Restricted Pod Security Standard, set securityContext.capabilities.drop: [ALL]. Only NET_BIND_SERVICE may be added back. If your policy targets NET_RAW alone, include it in the drop list and enforce that rule with a custom admission policy. Check that add does not restore it, review privilege escalation, and test the workload.
Examples
Dropping only SYS_ADMIN can leave NET_RAW available. The second Pod drops all capabilities and adds back NET_BIND_SERVICE. Keep it only if the app needs it.
Before
apiVersion: v1
kind: Pod
metadata:
name: example
spec:
containers:
- name: payment
image: nginx
securityContext:
capabilities:
drop:
- SYS_ADMIN
After
apiVersion: v1
kind: Pod
metadata:
name: example
spec:
containers:
- name: payment
image: nginx
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE