Kubernetes Security

Five RBAC Mistakes That Leave Kubernetes Clusters Exposed

By ··8 min read

RBAC misconfigurations are a common class of Kubernetes security issue, and the patterns below are ones I have run into in clusters I have worked on. Most of them are not the result of carelessness — they are the result of moving fast, copying examples from documentation, or applying patterns that work in development but become significant risks in production.

1. Wildcard verbs on core resources

A ClusterRole with verbs: ["*"] on core API resources is functionally equivalent to cluster root. Anyone or anything bound to that role can create, delete, modify, or read any resource in the cluster — including secrets, which means they can extract credentials used by every other workload.

Wildcard verb grants appear in many helm chart default values and in documentation examples designed for simplicity rather than production use. They get copied, the chart gets deployed, and the ClusterRole sits in the cluster indefinitely. A quick audit often surfaces several of these.

To find wildcard verb bindings in your cluster:

kubectl get clusterroles -o json | \
  jq '.items[] | select(.rules[].verbs[] == "*") | .metadata.name'

# Also check namespace-scoped roles
kubectl get roles -A -o json | \
  jq '.items[] | select(.rules[].verbs[] == "*") |
    {name: .metadata.name, namespace: .metadata.namespace}'

Replace wildcard verb grants with the minimum set of verbs the workload actually needs. For a read-only monitoring agent, that is typically get, list, watch. For a deployment controller, it might include get, list, watch, update, patch. Never *.

2. Binding ClusterRoles where namespace-scoped Roles suffice

The difference between a Role and a ClusterRole — and between a RoleBinding and a ClusterRoleBinding — is the blast radius of compromise. A Role operates within a single namespace. A ClusterRole operates across the entire cluster.

Many workloads — CI/CD agents, monitoring exporters, operators — are deployed with ClusterRoles because that is the default in their documentation, or because the engineer creating the RBAC was not sure which resources they would need and chose ClusterRole to be safe. The result is a workload in the staging namespace that can read secrets in the production namespace.

Audit which ClusterRoleBindings exist and whether each genuinely requires cluster-wide scope:

kubectl get clusterrolebindings -o wide

# For a specific service account
kubectl auth can-i --list \
  --as=system:serviceaccount:namespace:serviceaccount-name

3. Service account token auto-mounting left enabled

By default, Kubernetes mounts a service account token into every pod at /var/run/secrets/kubernetes.io/serviceaccount/token. If a container in that pod is compromised, the attacker immediately has a token they can use to authenticate to the Kubernetes API — with whatever permissions the pod's service account holds.

Most application workloads do not interact with the Kubernetes API at all. For them, token auto-mounting is pure exposure with no benefit. Disable it at the pod spec or service account level for all workloads that do not require Kubernetes API access:

# At the service account level
apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-app
  namespace: production
automountServiceAccountToken: false

# Or at the pod spec level
spec:
  automountServiceAccountToken: false

Workloads that do need Kubernetes API access — operators, controllers, monitoring agents — should have auto-mounting enabled only where genuinely required, bound to a scoped service account with minimal permissions.

4. Running workloads under the default service account

Every namespace in Kubernetes has a default service account. If a pod does not specify a service account, it runs under default. This matters for two reasons: the default service account often accumulates RBAC bindings added by engineers who did not create a dedicated service account, and any RBAC escalation through the default account affects all workloads in that namespace that also use it.

Every meaningful workload should have its own dedicated service account with permissions scoped only to what it needs. This makes RBAC auditing tractable — you can reason about what each workload can do — and limits the blast radius of any individual compromise.

# Find pods using the default service account
kubectl get pods -A -o json | \
  jq '.items[] | select(.spec.serviceAccountName == "default" or
    .spec.serviceAccountName == null) |
    {name: .metadata.name, namespace: .metadata.namespace}'

5. No RBAC audit logging or regular review cadence

RBAC configurations drift over time. Service accounts get created for debugging and never removed. ClusterRoles get broadened to unblock a deployment and never narrowed back. Helm chart upgrades introduce new RBAC objects that nobody reviews. Without a regular audit cadence, the RBAC state of a production cluster drifts towards permissiveness over months.

Kubernetes audit logging captures API server interactions including RBAC authorizations. Enable it and forward logs to your SIEM or log aggregation platform. Supplement this with tooling that can enumerate and report on RBAC state:

# Full inventory of all role bindings across the cluster
kubectl get rolebindings,clusterrolebindings -A -o wide

# rbac-lookup: find what roles a subject has
# https://github.com/FairwindsOps/rbac-lookup
rbac-lookup [email protected]

# kubectl-who-can: find who can do something
kubectl who-can get secrets -n production

Quick RBAC audit checklist

✓

Find all ClusterRoles with wildcard verbs on core API groups

✓

Review all ClusterRoleBindings and confirm cluster scope is necessary

✓

Disable automountServiceAccountToken on non-API workloads

✓

Enumerate pods using the default service account in each namespace

✓

Confirm Kubernetes audit logging is enabled and forwarded

✓

Schedule a quarterly RBAC review using rbac-lookup or equivalent tooling

RBAC is not a set-and-forget control. A strong RBAC posture comes from a regular review cadence, explicit service account provisioning standards, and automation that detects and alerts on wildcard permissions. These habits compound over time — and they are significantly cheaper to build early than to clean up later.

About the author

Written by Mahmoud Ali, founder of CoretiTech.

Get in touch →
Five RBAC Mistakes That Leave Kubernetes Clusters Exposed | CoretiTech