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
HighAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all Roles/ClusterRoles that grant
createonpods/exec.- Run on: any machine with kubectl access
-
Identify which subjects are bound to those Roles/ClusterRoles.
- Run on: any machine with kubectl access
-
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
createonpods/execonly for:- A small, named set of human users or groups (e.g. on-call SRE group)
- Very limited support automation, with strong justification
- Treat these as broad and usually inappropriate for
-
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/execinto 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.
- Decide whether to:
-
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 usingkubectl edit, then redeploy. -
Verify that
pods/execis only granted to the intended narrow subjects.- Run on: any machine with kubectl access
Using kubectl
Using kubectl
- Any rule with:
resources: ["pods/exec"](or included in a list)- AND
verbsincludingcreate(or*)
- Under
rules::resourcesincludespods/exec(explicitly or as part of a broader pattern like["*"]).verbsincludescreateor*.
- The role is clearly generic or broad, e.g.
cluster-admin,edit,viewcustomizations, or any “developer”, “default”, or “*” style role used by many users/groups/service accounts.
create on pods/exec:- Bindings that attach a
pods/execcreate-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.,
defaultin many namespaces)
- Bindings in many namespaces for the same permissive Role.
- These built-in roles are intentionally broad; if they (or custom equivalents) are widely granted, then many subjects may indirectly get
pods/execcreate. - This does NOT by itself say “fix this” — it tells you where exec is inherited from.
- Every object printed is a ClusterRole that grants
create(or*) onpods/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.
Automation
Automation
- Any ClusterRole or Role listed at the top sections is a candidate for review.
- In the bindings sections, pay special attention if:
Subjectsinclude wide groups likesystem:authenticated,system:serviceaccounts, or generic org-wide groups.SubjectsareServiceAccountobjects for workloads instead of human users.- The same exec-granting role is bound in many namespaces or via ClusterRoleBindings.

