Summary
CVE-2017-1002101 is a container escape vulnerability in Kubernetes subPath volume mount handling affecting versions 1.3.x through 1.9.3. A specially crafted pod spec combined with malicious container behavior — specifically, replacing the subPath target with a symlink — allows read and write access to arbitrary files and directories outside the intended volume, including the host filesystem. The vulnerability applies to all volume types including emptyDir and does not require a privileged pod, subject to file permissions on the target path.
Impact
Containers using subPath volume mounts can use symlink traversal to escape the volume boundary and access files on the host filesystem outside the specified volume. This applies to any volume type, including emptyDir volumes, meaning the attack does not require hostPath volumes or a privileged security context. Non-privileged pods can exploit this vulnerability subject to the file permission of the targeted host path. In clusters that allow untrusted users to control pod spec content and that rely on PodSecurityPolicy to prevent host filesystem access via hostPath volumes, this vulnerability circumvents that control.
Detection
The upstream advisory identifies two at-risk cluster configurations: clusters that allow untrusted users to control pod spec content and rely on PodSecurityPolicy to prevent hostPath-based host filesystem access, and clusters that make use of subPath volume mounts with untrusted containers or containers that may be compromised. Audit cluster workloads for both conditions — specifically, review pod specs for the presence of subPath in volume mount definitions combined with volume sources (including emptyDir) that are writable by the container. Note that PodSecurityPolicy's allowedHostPaths feature does not restrict symlink creation and traversal and therefore does not indicate that subPath-based traversal is prevented. Refer to the upstream issue for additional context.
Mitigation
Upgrade to the patched release for your release branch: v1.7.14, v1.8.9, or v1.9.4. Kubernetes versions 1.3.x through 1.6.x have no patch available within those branches and must upgrade to a patched minor release.
As a pre-upgrade mitigation, prevent untrusted users from creating pods and pod-creating objects such as Deployments and ReplicaSets. Alternatively, disable all volume types via PodSecurityPolicy — note that disabling all volume types also prevents the use of service account tokens in pods and requires setting automountServiceAccountToken: false on affected service accounts.
After upgrading, PodSecurityPolicy objects that rely on allowedHostPaths to restrict hostPath access must be updated to completely disable hostPath volumes, as the allowedHostPaths feature does not prevent symlink-based traversal beyond the declared path prefix. Future Kubernetes enhancements (tracked in the upstream issue) were required to make PodSecurityPolicy effectively restrict hostPath usage.