More Info:
Do not generally permit Windows containers to be run with the hostProcess flag set to trueRisk Level
LowAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Discover current usage of HostProcess in the cluster
- Run on: any machine with kubectl access
- Command (find all pods using
hostProcess: true): - Command (find all containers using
hostProcess: trueat container level):
-
Identify namespaces with user workloads and HostProcess usage
- Run on: any machine with kubectl access
- Command (list namespaces that currently have any HostProcess pod/container):
- Separately, determine which of these namespaces are “user workload” namespaces (vs. system/addon namespaces) according to your cluster’s conventions.
-
Review whether HostProcess is truly required in each affected user namespace
- For each user namespace found in step 2, list workloads and their images:
- For each workload using HostProcess (from step 1), review its purpose (docs, owners, code) and decide:
- Is HostProcess strictly needed (e.g., node management/diagnostics agents)?
- Can it be redesigned to run without HostProcess (e.g., normal Windows container, sidecar pattern, or different privilege model)?
- Document which specific deployments/DaemonSets, if any, are permitted to continue using HostProcess.
- For each user namespace found in step 2, list workloads and their images:
-
Define or tighten admission policy per user namespace to restrict HostProcess
- If you use Gatekeeper (OPA) or another admission controller, create or update a policy to deny new pods in target namespaces when any container or pod-level context has
securityContext.windowsOptions.hostProcess: true, with explicit exceptions only for approved workloads from step 3. Example (Gatekeeper ConstraintTemplate/Constraint) must be implemented according to your existing policy framework; apply via manifest: - If you have no admission policy framework, formally record that gap and plan adoption of a policy mechanism; without an admission controller there is no reliable automatic block on HostProcess.
- If you use Gatekeeper (OPA) or another admission controller, create or update a policy to deny new pods in target namespaces when any container or pod-level context has
-
Remove or reconfigure unauthorized HostProcess workloads
- For any workload in user namespaces where HostProcess is not justified:
- Edit workload to remove HostProcess and redeploy:
In the editor, remove or set to
falseany.spec.template.spec.securityContext.windowsOptions.hostProcess, and any container-level.securityContext.windowsOptions.hostProcess. Save and exit to trigger rollout. - If the workload’s function is no longer needed, delete it:
- Edit workload to remove HostProcess and redeploy:
- For any workload in user namespaces where HostProcess is not justified:
-
Verify that HostProcess usage is minimized and policy is effective
- Run on: any machine with kubectl access
- Re-run the evidence commands to confirm no unauthorized HostProcess pods remain:
- Attempt to create a simple test pod in a protected user namespace with
hostProcess: trueand confirm that the admission policy rejects it (or, if you have no admission controller, explicitly record that no technical enforcement exists and rely on process controls).
Using kubectl
Using kubectl
A list of namespaces where you should evaluate whether Windows HostProcess containers are appropriate. Any namespace that runs multi-tenant or untrusted workloads should be treated as high-risk if HostProcess is allowed.
Any line printed (not including the “No pods…” message) shows a pod with
hostProcess=true. For each such pod, you must decide whether it is strictly necessary and whether it’s placed only in namespaces where this level of privilege is acceptable.Any workload object listed with
hostProcess=true will continuously create HostProcess pods. You must review whether each such workload is necessary and whether its namespace should allow HostProcess at all.Look for labels like
pod-security.kubernetes.io/enforce, pod-security.kubernetes.io/audit, or pod-security.kubernetes.io/warn.If namespaces running untrusted or general user workloads have no PodSecurity labels, or are set to a profile that does not restrict HostProcess usage, this is a risk. A human must decide if stricter profiles should be applied.
If no constraints or PSPs are found that mention
windowsOptions or hostProcess, then there may be no central policy preventing arbitrary use of Windows HostProcess containers. A human must determine whether additional policy is required.Any occurrence of
hostProcess: true in a namespace that is intended for regular or multi-tenant workloads is a concern. You must decide whether to redesign these workloads or move them to tightly controlled namespaces.Verification after changes (policy or workload updates done manually):
hostProcess=true usages are in tightly controlled, explicitly approved namespaces, and admission policies for user-workload namespaces are in place (as manually confirmed), the finding is addressed.Automation
Automation
- Any line in the first two sections indicates a workload that is running or configured with
securityContext.windowsOptions.hostProcess=true.- Columns are:
NAMESPACE POD/WORKLOAD_NAME CONTAINER_NAME NODE OS hostProcess=true.
- Columns are:
- The final section lists namespaces that currently admit HostProcess workloads; these namespaces need manual review and, if not strictly required, admission policies to restrict
windowsOptions.hostProcess=trueas per the benchmark guidance.

