Critical Vulnerability in Kubernetes NFS CSI Driver Allows Path Traversal Attacks; Upgrade to v4.13.1 Urged

A critical path traversal vulnerability has been identified in the Kubernetes Container Storage Interface (CSI) Driver for NFS, potentially allowing attackers to delete or modify unintended directories on NFS servers. This flaw arises from insufficient validation of the `subDir` parameter in volume identifiers, exposing clusters that permit users to create PersistentVolumes referencing the NFS CSI driver.

Understanding the Vulnerability

The vulnerability resides in how the CSI Driver for NFS processes the `subDir` parameter during volume operations. Attackers with permission to create PersistentVolumes referencing the `nfs.csi.k8s.io` driver can craft volume identifiers containing path traversal sequences (`../`). When the driver processes volume deletion or cleanup operations, it may operate on directories outside the intended managed path within the NFS export.

For instance, malicious `volumeHandle` entries referencing paths such as `/tmp/mount-uuid/legitimate/../../../exports/subdir` could cause the CSI controller to traverse out of the designated directory scope, leading to unintended modifications or deletions on the NFS server.

Conditions for Exploitation

Organizations are potentially at risk if they meet all of the following conditions:

– They run the CSI Driver for NFS (`nfs.csi.k8s.io`) in their Kubernetes cluster.

– Their cluster allows non-administrator users to create PersistentVolumes referencing the NFS CSI driver.

– Their deployed CSI driver version does not validate traversal sequences in the `subDir` field.

All versions of the CSI Driver for NFS prior to v4.13.1 are affected by this vulnerability, as the traversal validation fix was introduced in that release.

Detection and Indicators of Compromise

Administrators can assess their cluster’s exposure by inspecting PersistentVolumes that use the NFS CSI driver and reviewing the `volumeHandle` field for traversal sequences such as `../`. Additionally, CSI controller logs should be examined for unexpected directory operations. Log entries resembling `Removing subPath: /tmp/mount-uuid/legitimate/../../../exports/subdir` are strong indicators of exploitation. Clusters showing evidence of active exploitation should be reported immediately to [email protected].

Remediation Steps

The primary remediation is upgrading the CSI Driver for NFS to version v4.13.1 or later, which includes proper validation of traversal sequences in the `subDir` field. As interim measures, administrators should:

– Restrict PersistentVolume creation privileges exclusively to trusted users.

– Audit NFS exports to confirm that only intended directories are writable by the driver.

As a broader security best practice, untrusted users should never be granted permission to create arbitrary PersistentVolumes referencing external storage drivers.

Responsible Disclosure and Fix

The vulnerability was responsibly disclosed by Shaul Ben Hai, Senior Staff Security Researcher at SentinelOne. The fix was developed and deployed by the CSI Driver for NFS maintainers Andy Zhang and Rita Zhang, in coordination with the Kubernetes Security Response Committee.

Conclusion

This vulnerability underscores the importance of rigorous input validation and access controls within Kubernetes environments. Administrators are urged to promptly upgrade their CSI Driver for NFS installations and review their cluster configurations to mitigate potential risks associated with this flaw.