C-0002 - Prevent containers from allowing command execution


NSA, MITRE, ClusterScan, ArmoBest, AllControls



Description of the the issue

Attackers who have permissions, can run malicious commands in containers in the cluster using exec command (“kubectl exec”). In this method, attackers can use legitimate images, such as an OS image (e.g., Ubuntu) as a backdoor container, and run their malicious code remotely by using “kubectl exec”.

Related resources

ClusterRole, ClusterRoleBinding, Role, RoleBinding

What does this control test

Check which subjects have RBAC permissions to exec into pods– if they have the “pods/exec” verb.


It is recommended to prohibit “kubectl exec” command in production environments. It is also recommended not to use subjects with this permission for daily cluster operations.


kind: Role
apiVersion: rbac.authorization.k8s.io/v1
  namespace: default
  name: pod-exec
- apiGroups: ["*"]
  resources: ["pods/exec"] # we look for this resource or *
  verbs: ["create"]	   # we look for this verb or *