Join our Newsletter — 33% off our NHI Course

Why does a writable /var/log mount increase the risk of node compromise in Kubernetes?

The risk comes from combining three conditions: a sensitive host directory, write access from inside the pod, and kubelet’s log handling on the node. If an attacker can replace a log file with a symlink, kubelet may read arbitrary host files with its own privileges. That can expose secrets, private keys, or other sensitive data on the node.

Why a Writable /var/log Turns a Pod Misconfiguration into Node Exposure

A writable /var/log mount is risky because it crosses a trust boundary: a path that looks like routine application storage becomes a writeable entry point into node-level log processing. Once a container can alter files that kubelet or node-side log collection expects to be stable, the attacker can try filesystem tricks such as symlink replacement to steer privileged reads toward sensitive host content.

How the Exploit Path Works on a Kubernetes Node

The core issue is not “logs” by themselves, but the interaction between container write access, host-mounted paths, and privileged node components that consume those paths. If log handling follows links or trusts filenames that an attacker can influence, the pod can turn a low-privilege file write into an arbitrary file read on the node. That is why a harmless-looking logging mount can become a local privilege boundary failure.

Once the node reads the wrong file, the attacker may gain access to data that was never intended to leave the host context, including credentials, certificates, or other sensitive system material. In practice, the dangerous condition is any mount that lets an untrusted workload modify files that node-level agents will later interpret as logs.

What Makes This Risk Material in Real Clusters

This pattern matters most when the container has both write access and a path that is shared with the host or with node-level log collection. A read-only root filesystem does not help if the log path itself is writable and monitored by a privileged process. The security outcome depends on how Kubernetes, the runtime, and the node’s logging pipeline handle path resolution, file ownership, and link following.

Operators should treat writable logging mounts as a file-system integrity issue, not just an application logging choice. The risk increases further in clusters with weak pod security, broad hostPath usage, or workloads that can run arbitrary code and manipulate the mounted directory structure.

Risk and Threat Considerations

The main exposure is host file disclosure through path confusion, but the same primitive can support broader node compromise if the attacker can reach secrets, kubelet-adjacent material, or other local trust anchors. The threat is attractive because it turns ordinary write access into a path toward privileged reads without needing direct node login.

Failure mechanism: An attacker with write access to the mounted log path replaces or reshapes a log file so that a privileged node-side reader follows a symlink or otherwise resolves the path to a sensitive host file.

Impact: The node may disclose secrets, private keys, or configuration material, which can expand to credential theft, lateral movement, or further cluster compromise.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

Framework Control / Reference Relevance
NIST SP 800-53 Rev 5 AC-6 — Least Privilege Writable log mounts expand access beyond intended app scope.
CM-6 — Configuration Settings Mount and path settings determine whether symlink abuse is possible.
SI-7 — Software, Firmware, and Information Integrity Log-path tampering can alter trusted node-side reads and integrity.
Recommendation — Restrict pod write access to only the log paths it truly needs. Harden mount and file handling settings to prevent unsafe path resolution. Validate file integrity and detect unexpected changes in monitored host paths.
ISO/IEC 27001:2022 A.8.9 — Configuration management Writable mounts are a configuration issue that can expose host data paths.
Recommendation — Review container and node configurations to keep writable paths out of privileged trust chains.
CIS Controls v8 CIS-4 — Secure Configuration of Enterprise Assets and Software Secure configuration reduces unsafe writable host-path exposure.
Recommendation — Harden container and node configurations to avoid writable host log paths.

Practitioner Guidance

What to verify: Confirm that the pod cannot write to any path consumed by node-side logging, and that log collection does not follow attacker-controlled links or trust writable filenames. Prefer read-only mounts for log destinations, and separate application logs from any host path that kubelet or a privileged agent may read.

Common mistake: Teams often focus on whether the container is “non-root” and miss the fact that write access to a shared log path can still give the workload a way to influence a privileged reader.

Practitioner takeaway: Treat writable log mounts as a filesystem trust boundary, because the real danger is not log tampering itself but the possibility of turning a benign write into a privileged host file read.