Skip to main content

More Info:

Do not generally permit containers with the potentially dangerous NET_RAW capability.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. 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.
  2. 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.
  3. 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 restricted or keep baseline and add an admission policy for NET_RAW.
    • If using OPA Gatekeeper or Kyverno, decide which policy engine to use or extend.
  4. 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_RAW entirely 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.
  5. 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:
  6. 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).
A problem exists if you find namespaces that run user workloads but have no policy objects controlling capabilities (next steps).
Problem indicators:
  • PSPs exist that are referenced by your workloads’ ServiceAccounts (RBAC bindings), and:
    • .spec.allowedCapabilities includes NET_RAW, or
    • .spec.defaultAddCapabilities includes NET_RAW, or
    • .spec.requiredDropCapabilities does not include NET_RAW while other caps are restricted
  • Or: there is no PSP at all in a cluster where PSP is the intended control.

Problem indicators:
  • 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.

Problem indicators:
  • Any container shows capsAdd:[NET_RAW ...] or similar in .securityContext.capabilities.add.
  • Workload manifests define securityContext.capabilities.add including NET_RAW, or fail to drop it when your policy model expects explicit dropping.

Problem indicators:
  • Webhooks that add NET_RAW to container capabilities.
  • Absence of any validating webhook that enforces dropping NET_RAW when your security model expects such enforcement.

Problem indicators:
  • 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_RAW unless controlled by other mechanisms.

Problem indicators:
  • Under spec.containers[].securityContext.capabilities.add, NET_RAW is present without a strong, documented business justification.
  • There is no organizational pattern (annotations, labels, documentation) explaining why NET_RAW is required.

Additional Reading: