RBAC roles permit privilege escalation

The bind and escalate permissions relax safeguards on role binding and role definition, respectively.

Description

Reserve bind and escalate for administrators who delegate permissions. With permission to create or update bindings, bind permits assigning a role whose permissions the caller lacks. With permission to create or update roles, escalate permits adding such permissions to a role.

Potential impact

Granting these verbs to an ordinary account can give it control over privileges beyond its own job.

Remediation

Separate administrative roles from ordinary user roles. Review create and update grants on roles, clusterroles, rolebindings and clusterrolebindings. Check all bindings for accounts that also receive bind or escalate.

Examples

The examples define ClusterRoles. They omit the bindings that would assign them to accounts.

Before

yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: rbac-binder
rules:
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["clusterroles"]
    verbs: ["bind"]
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["clusterrolebindings"]
    verbs: ["create"]

After

yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: not-rbac-binder
rules:
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["clusterrolebindings"]
    verbs: ["create"]

The second role still allows creation of ClusterRoleBindings but grants no bind. Unless another role grants bind, the caller must already hold the permissions in the role being bound at the applicable scope.

References