Sensitive hostPath Mounts

Pods mount sensitive directories or files from the node's filesystem, giving their containers access to node configuration, credentials or runtime sockets.

SeverityHigh
CVSS 3.18.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H Open in the calculator
CVSS 4.09.3 CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H Open in the calculator
CWECWE-552: Files or Directories Accessible to External Parties
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1611 Escape to Host, T1552.001 Credentials In Files
CategorySecurity Misconfiguration

Description

A hostPath volume mounts a file or directory from the node's own filesystem into a pod. When the path is sensitive, such as the root directory, /etc, /root, /home, /proc, /sys, /dev, the kubelet's directory /var/lib/kubelet, or the directories holding the container runtime's data and sockets, the container gains access to data and interfaces that belong to the node rather than to the workload.

Mounts are writable unless readOnly: true is set on the volume mount, and a writable mount of a sensitive path lets the container change the node's configuration directly: an attacker who compromises the container can usually take over the node, for example by adding a cron job, a systemd unit or an SSH key, or by changing files that the node runs as root, and taking over one node exposes every workload scheduled on it. Even a read-only mount can expose the kubelet's credentials, the secrets and service account tokens of other pods on the node, and keys stored on the node, giving the attacker node and cluster credentials that allow further movement through the cluster.

These volumes can be found by reviewing pod specifications or with configuration scanners. Some node agents use them legitimately, for example log collectors that read container logs, so each mount should be judged on its path, whether it is writable and what the workload needs.

Remediation

  • Remove hostPath volumes from application workloads, and use persistent volumes, emptyDir, ConfigMaps, Secrets or projected volumes for the data they need.
  • Where a node agent needs host files, mount the narrowest specific path rather than a parent directory, set readOnly: true on the volume mount wherever possible, and never mount the root directory, the kubelet's directory or container runtime sockets.
  • Run such containers as a non-root user, so that file permissions on the node still apply to them.
  • Enforce the Baseline or Restricted Pod Security Standard, which forbid hostPath volumes, on every namespace that does not need them, and where exceptions are required use a policy engine that allows only specific approved paths.
volumes: - name: app-logs hostPath: path: /var/log/app type: Directory containers: - name: log-collector volumeMounts: - name: app-logs mountPath: /logs readOnly: true

Confirm the fix by listing every hostPath volume in the cluster and checking that each remaining path is specific, read-only where possible, and documented.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Containers and Kubernetes Findings

Every Containers and Kubernetes finding