More Info:
Do not generally permit containers with the potentially dangerous NET_RAW capability.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify namespaces with user workloads and existing Pod Security controls
- Run on: any machine with kubectl access
- Decide which namespaces are for user workloads and require explicit restriction.
-
Review current use of NET_RAW in existing workloads
- Run on: any machine with kubectl access
- For each workload using NET_RAW, confirm whether it is strictly required for functionality.
-
Decide the policy mechanism to enforce NET_RAW restriction per namespace
- If using built-in Pod Security Admission (PSA):
Decide whether to move namespaces to
restrictedor keepbaselineand add an admission policy for NET_RAW. - If using OPA Gatekeeper or Kyverno, decide which policy engine to use or extend.
- If using built-in Pod Security Admission (PSA):
-
Review or define namespace-level policies that deny NET_RAW
- Example Gatekeeper audit (if Gatekeeper installed):
- Example Kyverno audit (if Kyverno installed):
- For each user-workload namespace, ensure there is a policy that either forbids
NET_RAWentirely or allows it only for explicitly named workloads. If missing, plan to create such a policy (e.g., Gatekeeper Constraint or Kyverno Policy) targeting that namespace.
- Example Gatekeeper audit (if Gatekeeper installed):
-
Tighten or add securityContext in manifests for required exceptions
- For workloads that legitimately need NET_RAW, explicitly declare and isolate the requirement in their manifests so policies can allow only those:
- Ensure manifests for workloads that do not need NET_RAW either omit capability additions or explicitly drop all capabilities:
-
Verify that admission is now minimized for NET_RAW
- After updating policies and manifests, test admission in a user-workload namespace that should be restricted:
- Confirm that this pod is rejected with an admission error referring to the policy (or, if allowed by design in a specific exception namespace, confirm that it is the only such namespace and that others are denied).
Using kubectl
Using kubectl
- PSPs exist that are referenced by your workloads’ ServiceAccounts (RBAC bindings), and:
.spec.allowedCapabilitiesincludesNET_RAW, or.spec.defaultAddCapabilitiesincludesNET_RAW, or.spec.requiredDropCapabilitiesdoes not includeNET_RAWwhile other caps are restricted
- Or: there is no PSP at all in a cluster where PSP is the intended control.
- Namespace has no Pod Security admission labels (e.g.
pod-security.kubernetes.io/enforce), so you rely only on ad‑hoc controls. - RBAC bindings grant access to permissive PSPs (from previous step) that allow
NET_RAW.
- Any container shows
capsAdd:[NET_RAW ...]or similar in.securityContext.capabilities.add. - Workload manifests define
securityContext.capabilities.addincludingNET_RAW, or fail to drop it when your policy model expects explicit dropping.
- Webhooks that add
NET_RAWto container capabilities. - Absence of any validating webhook that enforces dropping
NET_RAWwhen your security model expects such enforcement.
- Namespace labels such as:
pod-security.kubernetes.io/enforce=privileged- or no
pod-security.kubernetes.io/*labels at all
- In these cases, containers may run with
NET_RAWunless controlled by other mechanisms.
- Under
spec.containers[].securityContext.capabilities.add,NET_RAWis present without a strong, documented business justification. - There is no organizational pattern (annotations, labels, documentation) explaining why
NET_RAWis required.
Automation
Automation

