Skip to main content

More Info:

Windows HostProcess containers run with host-level privileges on the node. Restrict their admission in workload namespaces.

Risk Level

High

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify Windows HostProcess workloads in user namespaces
    • Run on: any machine with kubectl access
    • Command (lists pods that explicitly request HostProcess):
    • Repeat, but exclude known infrastructure namespaces (adjust as appropriate for your cluster):
  2. Decide where HostProcess containers are allowed (policy design)
    • For each user namespace, decide one of:
      • No HostProcess allowed (typical for most workloads).
      • HostProcess allowed only for specific, justified workloads (e.g., node maintenance agents).
    • Document for each namespace whether HostProcess is: forbidden, tightly controlled, or not yet decided.
  3. Review and, if needed, create/adjust admission controls (Pod Security or other)
    • If using built-in Pod Security Admission labels, for each user namespace that should forbid HostProcess, label it with at least baseline or restricted (both disallow HostProcess):
    • If you use another admission controller (e.g., Gatekeeper, Kyverno), review existing policies to ensure they deny pods with .securityContext.windowsOptions.hostProcess: true in any namespace that should not allow them. Use:
    • Where HostProcess must be allowed, design exception rules (e.g., labels/annotations on specific namespaces or service accounts) and ensure policies only allow HostProcess under those constrained conditions.
  4. Implement or tighten deny policies for HostProcess in user namespaces
    • Example Kyverno ClusterPolicy to deny all HostProcess containers except in explicitly allowed namespaces (windows-hostprocess-allowed=true):
    • Apply (adjust as needed for your own policy engine):
  5. Handle existing HostProcess pods in disallowed namespaces
    • For each pod from step 1 that is in a namespace now marked to forbid HostProcess:
      • Confirm with the owner whether the HostProcess capability is truly required.
      • If not required: update the pod spec / owning controller (Deployment, DaemonSet, Job, etc.) to remove .securityContext.windowsOptions.hostProcess: true, then redeploy.
      • If required: either
        • move the workload to a dedicated namespace explicitly marked to allow HostProcess (e.g., label windows-hostprocess-allowed=true), and keep strict controls there, or
        • adjust your policy design to formally permit it with documented justification.
  6. Verify that HostProcess admission is now minimized
    • Re-run the detection command to confirm there are no HostProcess pods in namespaces where they should be forbidden:
    • Independently test admission by attempting to create a sample HostProcess pod in a user namespace that should reject it and confirm it fails with a policy error:
      Confirm the admission controller rejects this pod creation.
Interpretation (what indicates a problem):
  • Step 3 / 4 / 5 outputs:
    • Any line where the last column is true means there is at least one Windows HostProcess container currently running in that namespace. That is not automatically wrong, but such pods should be reviewed and justified; user-workload namespaces should generally not contain HostProcess containers unless there is a documented, approved need.
  • Step 2 / 6 / 7 outputs:
    • If there are no Validating/Mutating webhooks or ValidatingAdmissionPolicies that reference windowsOptions or hostProcess, then there is likely no explicit admission control restricting Windows HostProcess containers.
    • In user-workload namespaces, “no hostProcess-related policies found” combined with evidence of HostProcess-true pods from steps 3–5 suggests a policy gap that needs human review and a possible policy design.
Verification after any policy changes:
These commands only surface state; a human must decide which namespaces may legitimately allow Windows HostProcess containers and what policy to apply.