Skip to main content

More Info:

Creating PersistentVolumes can enable privilege escalation via hostPath volumes. This permission should be limited to trusted administrators only.

Risk Level

High

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. On any machine with kubectl access, list all ClusterRoles and Roles that can create PersistentVolumes:
  2. For each identified ClusterRole/Role, list the subjects bound to it to understand who can create PersistentVolumes:
  3. For each Role/ClusterRole and its bound subjects, classify whether they are trusted administrators (e.g., dedicated admin groups, platform SRE service accounts) or non‑administrative users/workloads by reviewing your access model and group mappings (for example via your IdP or kubectl describe on ServiceAccounts):
  4. For any non‑administrative subject that should not create PersistentVolumes, edit the associated Role/ClusterRole to remove the create verb on persistentvolumes while preserving other needed permissions:
    In the editor, locate rules where resources includes persistentvolumes (or persistentvolume) and remove create (and * if overly broad) from verbs for that resource, or split the rule so PersistentVolumes no longer have create granted.
  5. Where a Role/ClusterRole exists solely to grant PV creation to non‑admins and is no longer required, remove the bindings or the role itself (after confirming no legitimate dependency):
  6. Verify that PV creation is now limited to the intended admin roles only by re-running the evidence collection and confirming that only trusted admin roles retain create on PersistentVolumes:
Problem indication:
  • Any listed ClusterRole or Role is capable of creating PersistentVolumes.
  • Pay particular attention to:
    • Broadly named roles such as edit, developer, default, or app-specific roles not intended for cluster administration.
    • Roles in application namespaces (e.g., team-a/*, prod-app/*) that include create or * on persistentvolumes.
Problem indication:
  • Under rules: you see entries like:
    • resources: ["persistentvolumes"] with verbs: containing create or *.
  • If the role name/purpose suggests non-admin usage, this is likely excessive.
Problem indication:
  • Same as for ClusterRole: any rule granting create or * on persistentvolumes to non-admin roles is suspect.
Problem indication:
  • subjects: includes:
    • Broad groups (e.g., system:authenticated, developers, ci-users).
    • Service accounts used by applications rather than administrators.
  • If such subjects are bound to a role that can create PersistentVolumes, this is a likely violation.
Problem indication:
  • Same as for ClusterRoleBinding: if non-admin users, groups, or service accounts are subjects, and the role grants create on persistentvolumes, this needs review.
Problem indication:
  • Output yes for identities that are not trusted administrators suggests privileges that should be reviewed and likely reduced.
Explanation of output that indicates a problem:
  • Any CLUSTERROLE: or ROLE: entry listed by this script that includes:
    • RESOURCES: persistentvolumes (or includes persistentvolumes in a list), and
    • VERBS: containing create
  • These roles grant the ability to create PersistentVolume objects.
  • For each such role, review who receives it using the clusterrolebinding and rolebinding listings:
    • If bound to non-administrative users, groups, or service accounts, this is a potential problem per CISAKS 4.1.8 and should be reviewed and likely removed or restricted.