Skip to main content

More Info:

Do not generally permit containers with capabilities

Risk Level

Low

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify namespaces where dropping all capabilities is acceptable
    • On any machine with kubectl access:
    • With your app/service owners, list namespaces whose workloads are non-privileged, non-infrastructure and can reasonably run without extra Linux capabilities (for example, pure HTTP APIs, batch jobs, or frontends).
  2. Inventory current capability usage in those namespaces
    • For each candidate namespace (replace TARGET_NS):
    • Also capture full security contexts for deeper review:
    • Review for any capAdd entries and for containers that do not specify drop: ["ALL"].
  3. Decide which workloads actually need capabilities
    • For each container with capAdd (or no drop: ["ALL"]), validate with the application owner and documentation whether these capabilities are functionally required.
    • Mark containers that:
      • Do not need any capabilities → should drop all.
      • Need only specific capabilities → should drop all by default and add back only the minimal required ones.
    • Where uncertain, plan controlled tests with reduced capabilities in a non‑production environment.
  4. Enforce “drop all capabilities” at the namespace level via policy
    • If you already use a policy engine (Pod Security Standards / Pod Security Admission, Kyverno, OPA Gatekeeper, or a PSP-like replacement), define or adjust a policy for each selected namespace to require drop: ["ALL"] and optionally forbid capAdd except for explicitly allowed cases. For example, using Kyverno (on any machine with kubectl access):
    • Adjust the example to your policy engine and list of target namespaces; review carefully before enforcing in production.
  5. Update existing workloads that violate the policy
    • For each deployment/statefulset/daemonset in the target namespaces, edit the manifest to drop all capabilities (example for a deployment):
      Edit APP_NAME-deploy.yaml to include, under each container:
      Then apply:
    • For pods created by other controllers (CronJobs, Jobs, Operators), update the relevant higher-level resource templates similarly.
  6. Verify effective enforcement and absence of unintended capabilities
    • Attempt to create a pod without dropping all capabilities in the protected namespace; confirm admission is rejected according to your policy engine.
    • Confirm running pods comply:
    • Periodically re-run this review when new workloads are added or when application requirements change.
Review this list and pick a namespace you expect should not need elevated capabilities (for example, “frontend”, “dev”, “testing”, or other app-only namespaces).
Problem indication:
  • Any non-empty add: line (for example [NET_ADMIN CAP_SYS_ADMIN]) means the container is requesting extra capabilities.
  • Missing or empty drop: where you expect all capabilities to be dropped may be a concern if the app does not need capabilities.
Problem indication:
  • securityContext.capabilities.add present with any capability values.
  • No securityContext.capabilities.drop and no higher-level policy (see below) in a namespace that should be locked down.
Problem indication:
  • allowedCapabilities contains capabilities beyond what is needed, especially *.
  • requiredDropCapabilities is empty or does not include ALL for namespaces that should drop all capabilities.
Look for labels like pod-security.kubernetes.io/enforce=privileged|baseline|restricted.Problem indication:
  • Namespaces that should run unprivileged workloads but are labeled with privileged or have no Pod Security labels and permit capabilities via other policies.
Problem indication:
  • No policy that restricts securityContext.capabilities for namespaces that do not need capabilities.
  • Policies explicitly allowing broad or unrestricted capabilities.
Problem indication:
  • securityContext.capabilities.add with capabilities like NET_ADMIN, SYS_ADMIN, NET_RAW, or many entries.
  • Containers running as root plus added capabilities without a clear business need.
Use the above outputs to decide, per namespace, whether workloads truly require capabilities; if not, plan to introduce or tighten policies that require dropping all capabilities and/or forbid adding new ones.
What output indicates a problem
  • In the “Pods with capabilities configured” section:
    • Any add: list that is not [] means the container is explicitly adding Linux capabilities.
    • Any drop: list that is [] or does not contain ALL means the container is not dropping all capabilities.
  • In the “Namespaces with pods that do NOT drop all capabilities” section:
    • Any namespace listed here contains pods where at least one container does not drop ALL capabilities; these namespaces should be reviewed, and where workloads do not require capabilities, admission policies should be considered to forbid such pods.

Additional Reading: