Kubernetes configuration allows an Unmasked proc mount

Allowing an Unmasked proc mount can remove the container runtime’s default path protections.

Description

Allow only Default in a legacy PodSecurityPolicy (PSP) field allowedProcMountTypes. Allowing Unmasked lets a container request that the runtime remove its default path protections.

Potential impact

Paths such as those normally masked or read-only in /proc can become accessible. The exposed information depends on namespaces, the runtime and process permissions.

Remediation

Keep workload procMount at its default and remove unnecessary privileges and host namespace sharing. On current clusters, enforce default mounts with Restricted Pod Security Admission or a policy engine, then verify the application still works.

Examples

Kubernetes deprecated PSP in 1.21 and removed it in 1.25. These excerpts show partial policies for clusters that support the old API.

Before

yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted
spec:
  allowedProcMountTypes:
    - Unmasked

After

yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted
spec:
  allowedProcMountTypes:
    - Default

The revised restricted policy permits only containers that retain default masking and read-only path protections.

References