Skip to main content

More Info:

Advisory: review Roles/ClusterRoles that grant create on pods/exec. Exec into a running pod bypasses image immutability and admission controls.

Risk Level

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List all Roles/ClusterRoles that grant create on pods/exec.
    • Run on: any machine with kubectl access
  2. Identify which subjects are bound to those Roles/ClusterRoles.
    • Run on: any machine with kubectl access
  3. Evaluate whether subjects are “broad” and if they truly need exec.
    • Treat these as broad and usually inappropriate for pods/exec:
      • system:authenticated, system:unauthenticated, system:serviceaccounts, system:serviceaccounts:*
      • Any group that represents all developers or all users
      • Wildcard subjects like many service accounts across multiple namespaces
    • Keep create on pods/exec only for:
      • A small, named set of human users or groups (e.g. on-call SRE group)
      • Very limited support automation, with strong justification
  4. Design the least-privilege change.
    For each over‑broad binding you found:
    • Decide whether to:
      • Remove the binding entirely, or
      • Replace broad groups with specific human users/groups, or
      • Move pods/exec into a separate, more restricted Role/ClusterRole and bind only to a small operator group.
        Document which Role/ClusterRole and which RoleBinding/ClusterRoleBinding you will edit and the new subject list.
  5. Apply the RBAC changes via manifests or kubectl edit.
    • Preferred (GitOps-friendly): export, edit, and apply.
    • Run on: any machine with kubectl access
    If manifests are managed by IaC, make equivalent edits in the source repo instead of using kubectl edit, then redeploy.
  6. Verify that pods/exec is only granted to the intended narrow subjects.
    • Run on: any machine with kubectl access
What to look for:
  • Any rule with:
    • resources: ["pods/exec"] (or included in a list)
    • AND verbs including create (or *)
Example problematic rule snippet:
or:

What to look for:
  • Under rules::
    • resources includes pods/exec (explicitly or as part of a broader pattern like ["*"]).
    • verbs includes create or *.
Flag as higher-risk if:
  • The role is clearly generic or broad, e.g. cluster-admin, edit, view customizations, or any “developer”, “default”, or “*” style role used by many users/groups/service accounts.

Then search for each Role/ClusterRole name that can create on pods/exec:
What indicates a problem:
  • Bindings that attach a pods/exec create-capable role to broad subjects, such as:
    • system:authenticated
    • Large identity groups (e.g., developers, all-users, ci-users) used by many people
    • Generic service accounts used cluster-wide (e.g., default in many namespaces)
  • Bindings in many namespaces for the same permissive Role.
Example concerning binding snippet:

What to note:
  • These built-in roles are intentionally broad; if they (or custom equivalents) are widely granted, then many subjects may indirectly get pods/exec create.
  • This does NOT by itself say “fix this” — it tells you where exec is inherited from.

Interpretation:
  • Every object printed is a ClusterRole that grants create (or *) on pods/exec.
  • For each of these, you must manually review:
    • Is this meant only for a very small, named set of human operators?
    • Are its bindings limited to those identities?
  • If the same role shows up here and is bound to broad groups or many service accounts (as seen in step 3), that’s a likely policy concern that needs design and approval rather than an automatic change.
What output indicates a problem
  • Any ClusterRole or Role listed at the top sections is a candidate for review.
  • In the bindings sections, pay special attention if:
    • Subjects include wide groups like system:authenticated, system:serviceaccounts, or generic org-wide groups.
    • Subjects are ServiceAccount objects for workloads instead of human users.
    • The same exec-granting role is bound in many namespaces or via ClusterRoleBindings.