Dangers Behind Access Control Understanding and Exploiting Implicit Permissions in Kubernetes

Published
Length
3 min read

Luis Felipe Dias

All posts

You fix the dangers behind access control understanding and exploiting implicit permissions in kubernetes by auditing additive RBAC rules and inspecting runtime pod commands. Teams must check both top-level resources and subresources across every namespace. Most platform teams start by binding broad cluster roles to help developers ship code fast. When roles stay too broad, a simple permission lets an attacker run commands inside running pods. That single gap can expose secrets across the whole

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You fix the dangers behind access control understanding and exploiting implicit permissions in kubernetes by auditing additive RBAC rules and inspecting runtime pod commands. Teams must check both top-level resources and subresources across every namespace. Most platform teams start by binding broad cluster roles to help developers ship code fast. When roles stay too broad, a simple permission lets an attacker run commands inside running pods. That single gap can expose secrets across the whole cluster.

How the dangers behind access control understanding and exploiting implicit permissions in kubernetes work

Kubernetes uses role-based rules to control who can talk to the cluster API. A Role sets permissions inside one single namespace. A ClusterRole sets permissions across the entire cluster, including nodes and all namespaces. You connect users to these roles with a RoleBinding or a ClusterRoleBinding.

In Kubernetes, all permissions are additive. There are no deny rules anywhere in the system. If a user gets two bindings, they get the sum of both rule sets. You cannot write a rule to block one risky action from a wide role. You have to build every role from scratch with only the exact rules needed.

Implicit risk often hides inside subresources. Kubernetes treats actions like reading pod logs or running pod commands as subresources. In the API, these show up with a slash, such as the pod log or pod exec subresource. When a role allows create actions on the pod exec subresource, that user can open a shell inside any matching pod. Once inside the pod, the user inherits the service account mounted in that container. If that container holds a strong role, the user just escalated their own access.

Another hidden trap involves restricting rules by resource name. Kubernetes lets you limit rules to specific named resources. Still, that name limit does not block create calls on subresources in the way many teams expect. A user might still trigger subresource actions if the parent rule is too loose.

Why native Kubernetes RBAC leaves a runtime gap

Native RBAC does a good job of checking who can call an API endpoint. It blocks unknown users from listing pods or deleting workloads. It also lets teams split duties by namespace so staging apps stay separate from production apps.

Still, RBAC only checks the front door of the API call. Once RBAC allows a pod exec request, Kubernetes stops checking what the user does next. The API server knows a user opened a shell in a pod. It does not check the shell commands running inside that container.

Just-in-Time Access + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Inside a running pod, an engineer can read local config files or query connected databases. They might run a query that returns user emails, phone numbers, card numbers, or national IDs. Native RBAC cannot inspect those commands in flight. It cannot rewrite matched fields in results to mask sensitive data. It also cannot require a peer to approve a single risky command while allowing safe read commands.

How to reduce implicit permission risk in your cluster

Start by listing every ClusterRoleBinding in your cluster. Look for bindings that grant wildcard verbs or wildcard resources to human groups or default service accounts. Replace each broad binding with a namespace RoleBinding that grants only read verbs on basic workload objects.

Next, separate pod viewing from pod execution. Give engineers permission to read pod status and pod logs for daily debugging. Keep the pod exec subresource out of standard developer roles. When someone needs to run commands in a live container or query a database, inspect those sessions at the command level.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Can I add a deny rule in Kubernetes RBAC to block pod exec?

No, Kubernetes RBAC is purely additive and has no deny rules. To block pod exec, you must remove the permission from every Role and ClusterRole bound to that user.

What is the difference between a RoleBinding and a ClusterRoleBinding?

A RoleBinding grants permissions inside one specific namespace, even when it points to a ClusterRole. A ClusterRoleBinding grants permissions across all namespaces and cluster-scoped resources like nodes.

Why is the pod exec subresource risky for access control?

Granting create access on the pod exec subresource lets a user run arbitrary shell commands inside a container. The user can then use the pod's mounted service account or read local app secrets.

The query runs. The emails stay hidden.