More Info:
The NET_RAW capability allows crafting raw packets for spoofing and network attacks. Restrict its admission in workload namespaces.Risk Level
HighAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify workload namespaces and existing policies
- On any machine with kubectl access:
- Decide which namespaces contain user workloads (exclude kube-system, monitoring, logging, etc. unless users run apps there).
- On any machine with kubectl access:
-
Review current use of NET_RAW in running workloads
- On any machine with kubectl access, for each workload namespace (substitute the namespace name):
- Record which applications currently rely on NET_RAW and confirm with the application owners whether it is truly required.
- On any machine with kubectl access, for each workload namespace (substitute the namespace name):
-
Review admission controls that could restrict NET_RAW
- On any machine with kubectl access:
- For each mechanism you find, inspect whether it already forbids adding
NET_RAWin workload namespaces (e.g., by disallowingcapabilities.addor explicitly listing forbidden capabilities).
- On any machine with kubectl access:
-
Decide namespace-by-namespace policy for NET_RAW
- For each workload namespace, make an explicit decision:
- Forbidden: no containers should ever use NET_RAW.
- Exception-only: NET_RAW allowed only for tightly controlled workloads.
- Document the decision with justification (e.g., “prod namespace: NET_RAW forbidden; only network diagnostics namespace allows it”).
- For each workload namespace, make an explicit decision:
-
Implement or tighten policies to enforce the decision
- This is done by editing/adding Kubernetes policy objects (Pod Security Admission labels, Gatekeeper/Kyverno policies, or PodSecurityPolicy if present). There is no single command that applies to every cluster.
- For the chosen mechanism, ensure policies for each workload namespace:
- Reject pods that add
NET_RAWunless they match an explicitly defined exception (e.g., label-based allowlist). - Apply policies to all relevant namespaces (via namespace labels, selectors, or target lists).
- Reject pods that add
- Use
kubectl apply -f <policy-file>.yamlfrom any machine with kubectl access to create/update these policy objects.
-
Verify that NET_RAW is effectively restricted
- On any machine with kubectl access, in a workload namespace that should disallow NET_RAW, try to create a test pod:
- Confirm that creation is rejected by the admission controls.
- Re-run the inspection to ensure no admitted pods use NET_RAW unexpectedly:
- On any machine with kubectl access, in a workload namespace that should disallow NET_RAW, try to create a test pod:
Using kubectl
Using kubectl
Using kubectl
1. List all namespaces that may host user workloads
Run on: any machine withkubectl access.The resulting list are candidate “user” namespaces where you should expect admission controls (Pod Security Admission, OPA/Gatekeeper, Kyverno, PSP if still used, etc.) to prevent
NET_RAW.2. Check for existing Pod-level security controls per namespace
2.1. Check Pod Security Admission labels (if PSA is in use)
Namespaces used for user workloads that:
- Have no
pod-security.kubernetes.io/enforcelabel, or - Are labeled
privilegedor an overly permissive level,
may allow pods with theNET_RAWcapability unless another policy mechanism blocks it.
2.2. List any PodSecurityPolicies (legacy PSP clusters only)
PSPs that:
- Do not restrict
allowedCapabilities, and - Do not list
NET_RAWunderforbiddenSysctls/capabilities-like controls (or otherwise constrain capabilities),
are likely to permitNET_RAW. Also check RBAC bindings to see which namespaces/pods can use such PSPs.
2.3. Check common policy engines (if deployed)
Gatekeeper (OPA) constraints:- No constraints limiting container capabilities, or
- Constraints that do not mention
NET_RAWin disallowed capabilities, or - Constraints not selecting the user namespaces.
Policies do not contain rules that deny or mutate away
NET_RAW, or are not applied (via match / exclude) to user namespaces.3. Identify pods/containers that currently request or add NET_RAW
This is evidence gathering; existing pods may be noncompliant with your intended policy.
jq is not available:Any line(s)/entries showing containers with:
pod.spec.securityContext.capabilities.add. Those pods are using NET_RAW and should be reviewed to determine if the capability is truly required.4. Check for Pod Security Standards violations (if PSA is enabled)
This does not directly “know” about NET_RAW but helps identify overly privileged pods.
- Namespaces or pods not being evaluated by PSA, or
- Pods running effectively at
privilegedlevel without other compensating policies, which makes it more likely they can useNET_RAW.
5. Optional: Dry-run admission test (non-production namespace)
Create a temporary test namespace:NET_RAW:- If the dry-run succeeds (“pod/net-raw-test-pod created (server dry run)”), there is currently no admission control in that namespace preventing
NET_RAW. - If the dry-run fails with a validation/admission error referring to capabilities or policies, then some control is in place; review the error text to confirm it is specifically blocking
NET_RAW.
Automation
Automation
- Any line under “Pods that explicitly ADD NET_RAW capability” indicates a problem for this control: those pods are being admitted with
NET_RAWand should be reviewed; if not strictly required, they should be reconfigured to drop it and/or blocked by admission policy. - Lines under “Pods with privileged=true or ALL capabilities” are high‑risk candidates: they may effectively allow raw network operations even if
NET_RAWis not explicitly listed. These require manual review to decide whetherNET_RAW(or equivalent capability) is actually needed and whether to tighten security. - Namespaces listed under “Namespaces where any pod adds NET_RAW” are priority targets for creating or tightening admission policies (e.g., PodSecurity, PodSecurityPolicies where still in use, or external admission controllers) to restrict
NET_RAWfor user workloads.

