Kubernetes check
Container root filesystem is writable
Trigger condition
A regular, init, or live ephemeral container's securityContext.readOnlyRootFilesystem is explicitly set to false, or is omitted (which Kubernetes itself defaults to false). An explicit true is not flagged; an omitted securityContext is treated the same as an omitted field. A Pod or Deployment template explicitly declaring spec.os.name as windows is skipped; an unspecified OS is evaluated using the Linux rule.
Evidence
States the container's type and name, and whether readOnlyRootFilesystem was explicitly set to false or was omitted and defaults to false.
Impact
A writable root filesystem lets a compromised process modify existing files, or write new files and tools, anywhere its own file permissions allow within the container's root filesystem. This describes only the declared root filesystem setting. A separate writable volume mount, such as an emptyDir for temporary files, can still allow writes even when the container's root filesystem is read-only; this is not evaluated here.
Recommendation
Set readOnlyRootFilesystem to true, after testing that the workload still starts and operates normally -- many images write to paths outside what the application actually needs at runtime. Move any genuinely required write to a narrowly scoped, writable volume mount (e.g. an emptyDir for temporary files) rather than leaving the whole root filesystem writable. For a Deployment-managed container, make the change in the Deployment's own Pod template and roll out the change. For a Pod with no verified owning Deployment, if a controller manages it (e.g. a DaemonSet or StatefulSet), make the change in that workload's own source configuration and follow its normal update process; if the Pod is standalone, make the change in its own source manifest and recreate it. When a live Pod's container is writable but its Deployment template's own matching container is not (or has no matching finding at all), check the Deployment's rollout status (an older replica may predate a template correction) and whether an admission-time mutation (e.g. a mutating webhook) altered that Pod independently of its template -- investigate through the owning controller rather than editing the Pod directly. For an ephemeral container, apply this corrected configuration to any future debug container attached to the Pod; clearing this existing one requires replacing the Pod itself, through the Eviction API or a normal Deployment rollout, after checking available capacity and any PodDisruptionBudget.
Important limitations
This check evaluates only securityContext.readOnlyRootFilesystem. It does not evaluate whether a mounted volume is itself writable, which can provide a write path regardless of this setting.