1. Resources
  2. Identity Threats
  3. Azure

AKS Cluster Identity and Kubernetes RBAC Abuse

Also known as: AKS admin credential abuse, AKS local account abuse, AKS kubeconfig theft, Azure Kubernetes Service privilege escalation, Kubernetes cluster role binding abuse

An Azure role on an AKS cluster can be turned into cluster administrator access through the local admin kubeconfig, Run command or a role binding, and kept with a Kubernetes or Azure grant.

Platform
Azure
Impact
High
Last updated
Attack difficulty
Medium
Detection difficulty
High
Privileges required: Specific rights or roles
An Azure role that can list cluster credentials, use Run command or assign roles on the cluster (for example Contributor), or a Kubernetes subject that can create role bindings.
What the attacker gains
Cluster administrator access: every Kubernetes Secret, every workload and the managed identities that nodes and pods use, with a credential that no longer depends on Microsoft Entra ID.
Threat groups
APT28APT29APT33APT38APT5HAFNIUMKe3changLAPSUS$NIMBUS MANTICOREScattered SpiderShinyHuntersStorm-0501TeamPCPTeamTNTand 1 more in MITRE ATT&CKGroups that MITRE ATT&CK records using T1098.006, T1078.004, T1609.

How it works

An AKS cluster has two authorization systems stacked on each other, and the attack lives in the seams between them.

  • Azure Resource Manager manages the cluster as an Azure resource: creating it, changing its settings, handing out kubeconfig files and running commands on it. Azure role-based access control decides these operations.
  • The Kubernetes API server manages what runs in the cluster: pods, Secrets, role bindings. It authenticates a subject (a user, a group, a service account) and authorizes each request, either with Kubernetes RBAC objects stored in the cluster or with Azure RBAC for Kubernetes authorization, or both.

Reaching the API server over the network proves nothing; authentication names a subject and authorization evaluates one request. A Microsoft Entra sign-in for the cluster identifies an authentication event, not a Kubernetes verb or namespace. But several Azure-side operations carry Kubernetes-side power, and that is where an Azure role becomes cluster control:

  • Local admin credential. Local accounts are enabled by default. Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action returns a kubeconfig with a client certificate that is cluster administrator and bypasses Microsoft Entra ID. The Azure Kubernetes Service Cluster Admin Role allows the action, and Azure Kubernetes Service Contributor Role, Contributor and Owner include it. Once downloaded, the certificate does not depend on the Azure identity that fetched it.
  • User credential on a cluster without Entra integration. listClusterUserCredential/action returns the clusterUser kubeconfig. On a cluster that uses Microsoft Entra ID it is empty and prompts a sign-in. On a cluster that does not, Microsoft states it has the same effect as clusterAdmin.
  • Run command. az aks command invoke runs kubectl or helm in a pod that AKS creates in the cluster, through the Azure API. It needs Microsoft.ContainerService/managedClusters/runCommand/action and commandResults/read, and it works on private clusters whose API server is not reachable from outside.
  • Azure RBAC for Kubernetes. On clusters that use it, an identity with Microsoft.Authorization/roleAssignments/write over the cluster can assign itself Azure Kubernetes Service RBAC Cluster Admin. This is role assignment abuse with a Kubernetes target.
  • Trusted Access role bindings. An Azure resource on the cluster that lets another Azure resource's managed identity call the API server. It is not a Kubernetes object and does not show up in a review of bindings inside the cluster.

Inside the cluster, the same escalation exists in native form. A subject that can create a ClusterRoleBinding can bind cluster-admin to any user, group or service account, and a service account token is a credential that needs no human sign-in. A RoleBinding can reference a ClusterRole while limiting it to one namespace, so the binding's kind and namespace matter as much as the role's name.

Prerequisites

One of:

  • An Azure role on the cluster, or a scope above it, that includes listClusterAdminCredential/action (with local accounts enabled), listClusterUserCredential/action (on a cluster without Entra integration), or runCommand/action (with Run command not disabled).
  • Microsoft.Authorization/roleAssignments/write over a cluster that uses Azure RBAC for Kubernetes authorization.
  • Microsoft.ContainerService/managedClusters/write, to re-enable local accounts or change the cluster's Entra admin groups.
  • A Kubernetes subject that can create or change role bindings, or read Secrets in a namespace that holds service account tokens.

For everything except Run command, the attacker also needs network access to the API server: a public endpoint, an allowed address range, or a position inside the virtual network of a private cluster.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

The steps below are for an authorized assessment or a lab.

1. Find clusters and read their identity settings

az aks list --query "[].{name:name, rg:resourceGroup, localAccountsDisabled:disableLocalAccounts, aad:aadProfile, api:apiServerAccessProfile}"

aadProfile shows whether the cluster uses Microsoft Entra ID and Azure RBAC for Kubernetes authorization, and apiServerAccessProfile shows whether it is private and whether Run command is disabled. A cluster with local accounts enabled and a caller that holds Contributor is the shortest path.

2. Download the local admin kubeconfig

az aks get-credentials --resource-group rg-prod --name aks-prod --admin

kubectl config view
kubectl auth can-i --list

On a cluster with local accounts disabled, the first command fails with a message that getting the static credential is not allowed. A role with write access to the cluster can turn them back on:

az aks update --resource-group rg-prod --name aks-prod --enable-local-accounts

3. Variant: Run command on a private cluster

az aks command invoke --resource-group rg-prod --name aks-prod \
  --command "kubectl get secrets --all-namespaces"

az aks command invoke --resource-group rg-prod --name aks-prod \
  --command "kubectl create clusterrolebinding ops-admin-binding --clusterrole=cluster-admin --user=alice@corp.example.com"

No network path to the API server is needed. The command runs in a pod inside the cluster and the output comes back through Azure.

4. Variant: self-grant with Azure RBAC for Kubernetes

AKS_ID=$(az aks show --resource-group rg-prod --name aks-prod --query id -o tsv)

az role assignment create --role "Azure Kubernetes Service RBAC Cluster Admin" \
  --assignee "alice@corp.example.com" --scope $AKS_ID

# Non-admin kubeconfig: sign-in goes through Microsoft Entra ID
az aks get-credentials --resource-group rg-prod --name aks-prod
kubectl get nodes

The same roles can be scoped to one namespace by appending /namespaces/<namespace> to the scope.

5. Take what the cluster holds

# Every Secret, including registry credentials and application secrets
kubectl get secrets --all-namespaces

# One Secret, decoded
kubectl get secret db-credentials -n payments -o jsonpath='{.data.password}' | base64 -d

# What the current subject may do in a namespace
kubectl auth can-i --list --namespace=payments

A pod started in the cluster can reach the instance metadata service of its node and request tokens as the node's managed identity. That is the bridge from the cluster back into Azure; see managed identity abuse.

6. Keep access with a Kubernetes grant

Bind cluster-admin to a service account and mint a token for it:

kubectl create serviceaccount metrics-agent -n kube-system
kubectl create clusterrolebinding metrics-agent-binding \
  --clusterrole=cluster-admin --serviceaccount=kube-system:metrics-agent
kubectl create token metrics-agent -n kube-system

The service account authenticates as a cluster identity. It appears in the cluster's audit log without any Microsoft Entra sign-in, and it survives the removal of the attacker's Azure role.

Impact

Cluster administrator access means every Kubernetes Secret, the ability to run any container on any node, and control of every workload's configuration and traffic. Secrets in a cluster usually include database passwords, registry credentials and API keys for systems outside it.

The cluster is also a stepping stone. Node and workload identities have Azure role assignments of their own, such as pulling from a container registry, reading a key vault or managing network resources, so lateral movement from the cluster into the subscription is often one token request away. And the local admin certificate, once copied, stays valid after the Azure account that fetched it is disabled: this is privilege escalation that detaches itself from the identity system.

OPSEC and artifacts

  • Using the local admin certificate. Requests made with it carry a shared certificate subject, not a person. The cluster's audit log shows what was done but can't say which holder of the kubeconfig did it. What remains on the Azure side is one listClusterAdminCredential/action record in the Activity Log, with the caller and address of whoever downloaded the file. Every later use is invisible to Azure Resource Manager.
  • Using Run command instead of a direct connection. Each invocation writes a runCommand/action record with the caller, but Microsoft does not document the command text as part of it. Inside the cluster, AKS creates a pod named command-<ID> in the aks-command namespace, and the API requests that pod makes are in the audit log.
  • Working where audit collection is thin. The kube-audit category must be routed by a diagnostic setting. Many clusters collect only kube-audit-admin, which leaves out get and list requests, so reading Secrets leaves no record there while creating a binding does. Operators who only read prefer such clusters.
  • Granting through Kubernetes, not Azure. A ClusterRoleBinding created with kubectl never passes through Azure Resource Manager. It is a write in the cluster's audit log and an object that stays in the cluster until deleted. Operators give it a name that fits the surrounding system objects.
  • Granting through Azure, not Kubernetes. A role assignment for an Azure Kubernetes Service RBAC role, or a Trusted Access role binding, is visible in the Activity Log but not among the binding objects inside the cluster.
  • Impersonation. When a request uses Kubernetes impersonation, the audit record holds both the authenticated user and the impersonated one. Reviews that read only one of them attribute the action to the wrong subject.
  • Re-enabling local accounts. Turning the setting back on is a write on the managed cluster resource, recorded in the Activity Log. Disabling local accounts later does not cancel certificates already issued; only rotating the cluster certificates does.

Detection

// Changes to RBAC objects in the cluster, with who made them and the result
AKSAudit
| where Stage == "ResponseComplete"
| where tostring(ObjectRef.resource) in ("clusterrolebindings", "rolebindings", "clusterroles", "roles")
| where Verb in ("create", "update", "patch", "delete")
| project TimeGenerated, User = tostring(User.username), Groups = tostring(User.groups), Verb,
          Resource = tostring(ObjectRef.resource), Name = tostring(ObjectRef.name),
          Namespace = tostring(ObjectRef.namespace), Code = toint(ResponseStatus.code), SourceIps
| order by TimeGenerated asc

A response code of 200 or 201 shows the subject could make that change at that time; a 403 records a refusal. Neither says which grant supplied the permission, so read the bindings and Azure role assignments in force at that moment before concluding how the subject got there.

Mitigation

  • Disable local accounts on clusters that use Microsoft Entra ID, so that the admin kubeconfig request fails and all access is tied to an identity:

    az aks update --resource-group rg-prod --name aks-prod --disable-local-accounts
    
  • Rotate cluster certificates after disabling them. Certificates handed out earlier stay valid until rotation. Plan it with the platform owner, because rotation disrupts clients:

    az aks rotate-certs --resource-group rg-prod --name aks-prod
    
  • Limit the Azure roles above the cluster. Contributor and Owner on the resource group or subscription include credential listing, Run command, cluster write and Trusted Access binding write. Give operators the narrower Azure Kubernetes Service Cluster User Role and Kubernetes permissions through groups, following least privilege.

  • Disable Run command where it is not needed, by setting apiServerAccessProfile.disableRunCommand on the cluster.

  • Use namespace-scoped grants for routine work. Keep cluster-admin and Azure Kubernetes Service RBAC Cluster Admin for a small, reviewed group, with Privileged Identity Management on the Azure side.

  • Review both sets of grants. Kubernetes bindings inside the cluster, and Azure role assignments, Trusted Access role bindings and Entra admin groups outside it.

  • Restrict the API server network path with a private cluster or authorized IP ranges, so a copied kubeconfig is not usable from the internet.

  • Collect the full audit log. Route kube-audit, not only kube-audit-admin, to a workspace outside the cluster administrators' ordinary control, together with the Activity Log.

  • Scope node and workload identities tightly, and prefer Microsoft Entra Workload ID for pods, so that a compromised cluster does not hand out broad Azure roles through the node's identity.

Detection rules for this attack

Log events to collect

FAQ

What is the AKS local admin account?

It is a built-in cluster administrator credential, a client certificate, that every AKS cluster has unless local accounts are disabled. az aks get-credentials --admin downloads it. Microsoft describes it as a non-auditable backdoor option that still exists when Microsoft Entra integration is enabled, because it bypasses Entra ID entirely.

Does Microsoft Entra integration stop an Azure Contributor from becoming cluster admin?

Not by itself. A role that can list the cluster admin credential gets the certificate-based kubeconfig regardless of Entra integration. Only disabling local accounts makes that request fail, and a role with write access to the cluster can re-enable them, so both the setting and the roles above it need control.

What is the difference between Kubernetes RBAC and Azure RBAC for Kubernetes authorization?

Kubernetes RBAC stores Role, ClusterRole and binding objects inside the cluster. Azure RBAC for Kubernetes authorization lets Azure role assignments with Kubernetes data actions, such as Azure Kubernetes Service RBAC Cluster Admin, decide requests by Microsoft Entra identities. Both can be active, and Kubernetes RBAC still applies to service accounts.

Which logs show what was done inside an AKS cluster?

Only the cluster's own audit logs. The Azure Activity Log shows that a kubeconfig was listed or Run command was used and by whom. Requests to the Kubernetes API server appear in the kube-audit resource log category when a diagnostic setting collects it. The smaller kube-audit-admin category leaves out get and list requests.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.