Skip to main content

More Info:

Containers sharing the host IPC namespace can access inter-process communication of other host processes. Their admission should be restricted via Pod Security Admission policies.

Risk Level

High

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify namespaces with user workloads
    • Run on: any machine with kubectl access
    Decide which namespaces are user-facing (exclude system namespaces like kube-system, kube-public, kube-node-lease, and cloud-provider/system add-on namespaces).
  2. Find existing pods that use hostIPC: true
    • Run on: any machine with kubectl access
    Review any listed pods with application owners and decide whether hostIPC is strictly required. If not, plan to remove it from their Pod/Deployment/StatefulSet manifests and redeploy.
  3. Review current Pod Security labels on namespaces
    • Run on: any machine with kubectl access
    For each user namespace, check whether pod-security.kubernetes.io/enforce (or pod-security.kubernetes.io/warn) is present and what level it is set to (privileged, baseline, or restricted). Note that restricted disallows hostIPC: true.
  4. Decide the appropriate policy level per namespace
    • For each user namespace:
      • If no workloads require hostIPC, plan to enforce restricted.
      • If some workloads temporarily require hostIPC, consider baseline or an exception namespace for those workloads, and plan to migrate them off hostIPC where possible.
      • Document any justified exceptions, including owning team, purpose, and review date.
  5. Apply or adjust namespace Pod Security labels
    • Run on: any machine with kubectl access
    • To enforce restricted where hostIPC is not required:
    • To add a warning-level policy (e.g., cluster-wide baseline warnings):
    Replace NAMESPACE with each chosen user namespace. Coordinate with application owners before enforcing in production to avoid unexpected admission failures.
  6. Verify the effect of the policy and current usage
    • Confirm namespace labels:
    • Attempt (in a test namespace) to create a pod with hostIPC: true and ensure it is rejected where enforce=restricted is set.
    • Re-run the hostIPC usage scan to confirm no unintended hostIPC pods remain:

Using kubectl

1. List pods using hostIPC

Run on: any machine with kubectl access.
Output indicating a problem:
  • Any line (other than the header) where HOST_IPC is true is a pod sharing the host IPC namespace and must be reviewed.
To see full spec for a specific pod:
Check:
  • .spec.hostIPC: true → this pod is sharing host IPC.

2. See current Pod Security Admission labels on namespaces

Run on: any machine with kubectl access.
Output indicating a problem (with respect to host IPC restriction):
  • Namespaces that run user workloads and:
    • Have ENFORCE unset or set to privileged may allow hostIPC: true unless other policies exist.
    • Use baseline instead of restricted may still allow some higher-risk options; verify separately with your policy requirements.
You must decide:
  • Which namespaces should be hardened (e.g., enforce=restricted).
  • Whether any hostIPC: true pods are strictly necessary for their workloads.

3. Check for namespace-level policies that might already restrict hostIPC (optional deeper review)

If you use Gatekeeper/OPA or other policy engines, list their constraints (example for Gatekeeper):
Output indicating a problem:
  • No constraints referencing hostIPC or similar fields means nothing (beyond Pod Security Admission) is limiting host IPC usage, so hostIPC: true pods you found are likely admitted without additional controls.

These commands only surface the current state. A human must review which hostIPC: true pods are justified and whether namespace labels and policies are appropriate for your risk tolerance.
Explanation of output indicating a problem:
  • In “Pods requesting hostIPC=true” and “Detail: pods with hostIPC=true and their containers”:
    • Any listed pod is a potential issue. Each such pod should be reviewed to determine if hostIPC is strictly necessary.
  • In “Summary: count of pods with hostIPC=true per namespace”:
    • Namespaces with non‑zero HOSTIPC_POD_COUNT require review; high counts suggest broader policy gaps.
  • In “Namespace Pod Security labels”:
    • Namespaces running user workloads that:
      • lack pod-security.kubernetes.io/enforce=restricted, or
      • have no ENFORCE label at all, should be evaluated. If workloads do not require hostIPC or other privileged features, consider enforcing the restricted profile (or stronger controls via alternative mechanisms).