CNTR-K8-000440 - The Kubernetes kubelet staticPodPath must not enable static pods.

Information

Allowing kubelet to set a staticPodPath gives containers with root access permissions to traverse the hosting filesystem. The danger comes when the container can create a manifest file within the /etc/kubernetes/manifests directory. When a manifest is created within this directory, containers are entirely governed by the Kubelet not the API Server. The container is not susceptible to admission control at all. Any containers or pods instantiated in this manner are called 'static pods' and are meant to be used for pods such as the API server, scheduler, controller, etc., not workload pods that need to be governed by the API Server.

Solution

1. Remove staticPodPath setting on Kubernetes worker nodes:

a. On each Worker node, run the command:
ps -ef | grep kubelet

b. Note the path to the config file (identified by --config).

c. Edit the Kubernetes kubelet file in the --config directory on the Worker nodes. Remove the setting 'staticPodPath'.

d. Restart the kubelet service using the following command:
systemctl daemon-reload && systemctl restart kubelet

2. Remove Kubelet Systemd Service Arguments:

a. Modify the systemd Service File. Run the command:
sudo systemctl edit --full kubelet

(Example Return:ExecStart=/usr/bin/kubelet --pod-manifest-path=/etc/kubernetes/manifests)

b. Find and remove --pod-manifest-path.

c. Save and exit the editor.

d. Restart the kubelet service using the following command:
systemctl daemon-reload && systemctl restart kubelet

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Kubernetes_V2R3_STIG.zip

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-3, CAT|I, CCI|CCI-000213, Rule-ID|SV-242397r1069464_rule, STIG-ID|CNTR-K8-000440, Vuln-ID|V-242397

Plugin: Unix

Control ID: 84e47b015132f3391e63108432d90d98e74a3078dea0d62fd8f5298bc5d9ec55