Created on 2026-12-02


Kubernetes Hardening L4a: Human Identity, RBAC Pitfalls, and the nodes/proxy GET Escalation

TL;DR: Never distribute static client certificates or system:masters kubeconfigs for day-to-day engineering access - Kubernetes has no native certificate revocation list (CRL), and system:masters bypasses the RBAC authorizer completely. Wire short-lived OIDC tokens into kube-apiserver using AuthenticationConfiguration with CEL claim validation on bare metal (via Keycloak [CNCF Incubating] or Dex [CNCF Sandbox]), or use native cloud identity mappings (EKS Access Entries, GKE Google Groups for RBAC, AKS Entra ID with --disable-local-accounts). Audit your RBAC tree for privilege escalation primitives (escalate, bind, impersonate, serviceaccounts/token, pods/ephemeralcontainers, list on secrets), and eliminate nodes/proxy get permissions from monitoring agents by migrating to Fine-Grained Kubelet Authorization (KEP-2862, GA in Kubernetes 1.36).

Why Static Kubeconfigs and Client Certificates Fail

When kubeadm init bootstraps a cluster, it writes /etc/kubernetes/super-admin.conf (introduced in Kubernetes 1.29) containing a client X.509 certificate valid for one year with the subject O = system:masters, CN = kubernetes-super-admin, alongside /etc/kubernetes/admin.conf bound via RBAC to kubeadm:cluster-admins. In far too many bare-metal and early-stage cloud setups, one of these static files gets copied into a team password manager or CI variable and shared across the engineering org.

This fails three basic security invariants:

  1. Client certificates cannot be revoked individually. The Kubernetes API server validates client certificates against the CA bundle specified in --client-ca-file. It does not support OCSP stapling or CRL checking. If an engineer's laptop is compromised or they leave the company, their client certificate remains valid until its NotAfter timestamp. Your only remediation is rotating the entire cluster client CA and re-issuing certificates to every control-plane component.
  2. system:masters bypasses RBAC. Inside kube-apiserver, requests authenticated with the group system:masters match a built-in superuser authorizer that executes before the RBAC authorizer. You cannot write a ClusterRole restriction or remove permissions from system:masters. Even if you delete every ClusterRoleBinding in the cluster, a client certificate bearing O = system:masters retains full unrestricted root access.
  3. Zero individual attribution in audit logs. When five engineers share kubernetes-admin, every destructive kubectl delete or kubectl exec records "user": {"username": "kubernetes-admin", "groups": ["system:masters", "system:authenticated"]} in the audit log. Incident response starts blind.

Short-Lived OIDC SSO and Structured Authentication

Human access to kube-apiserver should rely exclusively on OpenID Connect (OIDC) authorization code flows with PKCE (executed on the CLI via kubectl oidc-login / kubelogin). Instead of a static credential on disk, the engineer authenticates against your corporate Identity Provider (IdP) with hardware MFA and receives a signed JWT ID token with a 15-to-60-minute TTL.

Human Authentication and Authorization Architecture

Self-Hosted Bare Metal: OIDC Group Mapping via Structured Authentication

With Structured Authentication Configuration (apiserver.config.k8s.io/v1, Beta in Kubernetes 1.30 as v1beta1, GA in Kubernetes 1.34 as v1) paired with KEP-4633 (AnonymousAuthConfigurableEndpoints, also GA in Kubernetes 1.34), you replace legacy --oidc-* and --anonymous-auth CLI flags with --authentication-config=/etc/kubernetes/auth/authentication-config.yaml. Note that leaving any legacy --oidc-* or conflicting --anonymous-auth flag on kube-apiserver causes startup to fail.

In Layer 3, we covered the complete multi-issuer AuthenticationConfiguration including KEP-4633 health-only anonymous access and CI runners. For Layer 4a human RBAC, focus on the claim validation, oidc: prefixing, and system: anti-spoofing rules for your bare-metal Keycloak or Dex broker:

# Human OIDC RBAC mapping excerpt from /etc/kubernetes/auth/authentication-config.yaml
# (See Layer 3 for the full multi-issuer + KEP-4633 anonymous configuration.)
apiVersion: apiserver.config.k8s.io/v1
kind: AuthenticationConfiguration
jwt:
  - issuer:
      url: https://sso.bard.sh/realms/platform
      audiences:
        - k8s-prod-cluster
      audienceMatchPolicy: MatchAny
    claimValidationRules:
      - expression: 'has(claims.email_verified) && claims.email_verified == true'
        message: "OIDC email address must be verified by the identity provider."
      - expression: 'has(claims.email) && claims.email.endsWith("@bard.sh")'
        message: "Only bard.sh corporate domain accounts are permitted."
    claimMappings:
      username:
        expression: '"oidc:" + claims.email'
      groups:
        # Guard has(claims.groups) so tokens without group memberships do not fail CEL evaluation
        expression: 'has(claims.groups) ? claims.groups.map(g, "oidc:" + g) : []'
      uid:
        claim: sub
    userValidationRules:
      - expression: '!user.username.startsWith("system:")'
        message: "Username cannot spoof reserved system: identities."
      - expression: 'user.groups.all(g, !g.startsWith("system:"))'
        message: "Mapped groups cannot spoof reserved system: groups."

Prefixing every OIDC username and group with oidc: and rejecting system:* in userValidationRules ensures that even if an attacker modifies group names inside Keycloak, they cannot mint a token that maps to system:masters or system:nodes.

Managed Kubernetes: EKS, GKE, and AKS

On managed clusters, use the provider's native control-plane identity integration rather than maintaining a custom OIDC broker, while also disabling legacy admin backdoors.

AWS EKS: Access Entries Over aws-auth

For years, EKS mapped AWS IAM principals to Kubernetes users via the kube-system/aws-auth ConfigMap. That design was notorious for operational outages: a single YAML syntax error in aws-auth broke node registration and locked administrators out of the cluster.

Modern EKS clusters should set authentication_mode = "API" (eliminating aws-auth entirely) and manage human SSO roles through EKS Access Entries backed by AWS IAM Identity Center (formerly AWS SSO). Crucially, bind the Access Entry to a Kubernetes group and manage granular permissions via standard Kubernetes RBAC (or scoped EKS Access Policies), and set bootstrap_cluster_creator_admin_permissions = false so the IAM role that ran terraform apply does not retain hidden permanent cluster-admin privileges:

resource "aws_eks_cluster" "prod" {
  name     = "prod-eu-central-1"
  role_arn = aws_iam_role.cluster_control_plane.arn
  version  = "1.36"

  access_config {
    authentication_mode                         = "API"
    bootstrap_cluster_creator_admin_permissions = false
  }

  vpc_config {
    endpoint_private_access = true
    endpoint_public_access  = false
    subnet_ids              = var.private_cp_subnet_ids
  }
}

resource "aws_eks_access_entry" "platform_oncall" {
  cluster_name      = aws_eks_cluster.prod.name
  principal_arn     = var.aws_sso_platform_engineer_role_arn
  kubernetes_groups = ["oidc:platform-engineers"]
  type              = "STANDARD"
}

GCP GKE: Google Groups for RBAC

On GKE, configure authenticator_groups_config on the cluster pointing to a dedicated umbrella Google Group (for example, [email protected]). Any nested group inside that umbrella group is automatically populated in the authenticated user's token claims, allowing you to bind Kubernetes RoleBindings directly to group: [email protected] without touching cluster configuration when engineers join or leave a team.

Azure AKS: Entra ID with Local Accounts Disabled

By default, AKS maintains a static local cluster administrator account accessible via az aks get-credentials --admin. Any Azure principal with the Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action permission can download a static system:masters kubeconfig that bypasses Entra ID conditional access and MFA. Always disable local accounts in production:

az aks update \
  --resource-group rg-prod-aks \
  --name aks-prod-weu \
  --enable-aad \
  --enable-azure-rbac \
  --disable-local-accounts

Managed vs Bare Metal Comparison

Control Dimension AWS EKS GCP GKE Azure AKS Self-Hosted Bare Metal
Primary Human AuthN EKS Access Entries + IAM Identity Center (or OIDC federation) Google Cloud Identity + Google Groups for RBAC Microsoft Entra ID + Azure RBAC for Kubernetes AuthenticationConfiguration + Keycloak or Dex
Static Admin Backdoor Cluster creator admin (bootstrap_cluster_creator_admin_permissions) - set to false Legacy client certificate auth - disabled by default on modern GKE Local admin account (--admin) - disable via --disable-local-accounts /etc/kubernetes/super-admin.conf (system:masters) - restrict to root on CP nodes only
Multi-Issuer & CEL Rules Native OIDC Identity Provider associations support standard claims GKE Identity Service (Anthos/Fleet) or native IAM Entra ID Conditional Access + Managed Identity Full apiserver.config.k8s.io/v1 CEL claimValidationRules and hot reload
Anonymous Auth Restriction Managed by AWS (restricted on recent versions) Managed by Google Managed by Microsoft You: Configure KEP-4633 (anonymous.conditions limited to /healthz, /livez, /readyz)
Break-Glass Mechanism Dedicated IAM role + Access Entry gated by AWS IAM Identity Center approval PAM (Privileged Access Manager) temporary IAM grant Entra ID Privileged Identity Management (PIM) JIT activation Offline hardware-backed cert or dedicated OIDC emergency client + immediate SIEM alert

Eliminating system:masters and Designing Break-Glass Access

On bare-metal clusters bootstrapped with kubeadm (since Kubernetes 1.29), kubeadm init automatically generates two separate kubeconfigs: /etc/kubernetes/super-admin.conf (carrying O = system:masters strictly for local emergency recovery when the external OIDC IdP is unreachable) and /etc/kubernetes/admin.conf (carrying O = kubeadm:cluster-admins, which is governed by standard RBAC and can be revoked by deleting its ClusterRoleBinding). Never copy either file off the control-plane hosts into shared password managers; keep super-admin.conf 0600 root-only on control-plane disks (or sealed offline in a physical safe / HSM-backed break-glass store).

Your break-glass architecture should follow three rules:

  1. Just-In-Time (JIT) elevation. On managed clouds, use AWS IAM Identity Center temporary elevation, GCP Privileged Access Manager (PAM), or Azure Entra PIM with mandatory ticket justification and peer approval. On bare metal, use Teleport or a dedicated Keycloak emergency client that requires hardware FIDO2 WebAuthn authentication and issues a 15-minute token mapped to oidc:break-glass-admin.
  2. Dedicated OIDC break-glass subject. Bind the break-glass ClusterRoleBinding strictly to oidc:break-glass-admin (never a system: prefix, which your userValidationRules explicitly reject) so it never fires during normal operations.
  3. High-priority paging on use. Configure your audit log pipeline (Fluent Bit [CNCF Graduated] or OpenTelemetry Collector [CNCF Graduated]) to page the security on-call rotation immediately whenever any request carries "groups": ["system:masters"] or "oidc:break-glass-admin".

Dangerous RBAC Permissions: The Silent Escalation Paths

You do not need cluster-admin to own a Kubernetes cluster. Several standard RBAC verbs act as direct privilege escalation primitives. When reviewing third-party Helm charts or tenant roles, treat all seven of the following permissions as equivalent to root:

Resource Verb(s) Escalation Mechanics Remediation
clusterroles, roles escalate, bind escalate lets a principal create or modify roles with permissions they do not possess themselves. bind lets them bind existing high-privilege roles (including cluster-admin) to their own account. Never grant escalate or bind to humans or non-controller workloads. Enforce via ValidatingAdmissionPolicy.
users, groups, serviceaccounts impersonate Allows setting Impersonate-User or Impersonate-Group HTTP headers on any API call, immediately assuming the target identity's full RBAC permissions. Restrict strictly to identity-aware proxies (such as Pomerium or Teleport) and scope resourceNames to non-system identities.
secrets list, watch Kubernetes API trap: In Kubernetes RBAC, resourceNames does not restrict list or watch requests. Any rule granting list or watch on secrets returns the complete .data payload of every Secret in the namespace (or cluster). Never grant cluster-wide list or watch on secrets to human roles or CI runners. Grant get with explicit resourceNames where possible.
serviceaccounts/token create Calls the TokenRequest subresource to mint a valid, signed projected JWT for any ServiceAccount in the namespace, allowing lateral movement into privileged operator SAs. Block serviceaccounts/token create for human users; reserve only for identity controllers.
pods/exec, pods/attach create, get Executes arbitrary commands or attaches to streams inside a running pod, allowing theft of mounted projected tokens, memory inspection, or database credential extraction. Disable pods/exec and pods/attach in production namespaces; rely on structured logs and metrics. Require break-glass elevation for live debugging.
pods/ephemeralcontainers update, patch Lets kubectl debug attach a new debug container (with arbitrary image and shared process namespace) into a running pod to inspect its filesystem, memory, and mounted credentials. Deny update and patch on pods/ephemeralcontainers in production namespaces outside audited break-glass roles.
certificatesigningrequests/approval update Combined with create on certificatesigningrequests, allows an attacker to submit and self-approve a CSR for any username or group supported by the signer. Restrict CSR approval exclusively to automated controllers (such as cert-manager [CNCF Graduated] or kubelet-csr-approver).

Deep Dive: The nodes/proxy GET to Container RCE Escalation

Even teams that carefully strip pods/exec and secrets from their RBAC roles frequently leave a critical backdoor wide open: nodes/proxy with the get verb.

For years, the standard installation manifests for Prometheus (kube-prometheus-stack), VictoriaMetrics, Datadog, and custom telemetry collectors included a ClusterRole rule similar to this:

# VULNERABLE LEGACY MONITORING ROLE - DO NOT USE
rules:
  - apiGroups: [""]
    resources:
      - nodes
      - nodes/proxy
      - nodes/metrics
    verbs: ["get", "list", "watch"]

At first glance, verbs: ["get"] looks completely read-only. In standard Kubernetes REST semantics, get retrieves a resource representation while create or post mutates state.

Why GET on nodes/proxy Grants Full RCE

The nodes/proxy subresource authorizes direct proxy access to the Kubelet HTTPS API (10250) on every node in the cluster. Furthermore, when the Kubelet runs with --authorization-mode=Webhook (the hardened standard), it sends a SubjectAccessReview back to kube-apiserver mapping incoming requests to nodes/proxy.

Here is the fatal protocol detail: while the Kubelet's /run endpoint is POST-only (mapping to create), the streaming endpoints /exec/{namespace}/{pod}/{container}, /attach, and /portForward initiate their WebSocket or SPDY connection upgrade using an HTTP GET request:

GET /exec/kube-system/cilium-x8k9p/cilium-agent?command=/bin/sh&input=1&output=1&tty=1 HTTP/1.1
Host: 10.240.0.14:10250
Authorization: Bearer <compromised-prometheus-sa-token>
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==

Because the initial HTTP method is GET, the Kubelet maps the authorization check to verb: get on resource: nodes, subresource: proxy. The SubjectAccessReview succeeds! The Kubelet upgrades the TCP connection to a bidirectional WebSocket stream, and the caller now has an interactive root shell inside cilium-agent (or any other pod on that node).

Worse still: if the attacker sends this HTTP GET upgrade directly to the node's Kubelet IP on port 10250 using a stolen Prometheus ServiceAccount token rather than routing through kube-apiserver, the kube-apiserver audit log never sees the /exec path - it only logs a generic SubjectAccessReview check for nodes/proxy get, which looks identical to a routine 15-second Prometheus scrape.

Legacy nodes/proxy GET Escalation vs KEP-2862 Fine-Grained Kubelet AuthZ

The Fix: Fine-Grained Kubelet Authorization (KEP-2862, GA in 1.36)

To close this architectural flaw without breaking monitoring agents, Kubernetes introduced Fine-Grained Kubelet API Authorization (KEP-2862, promoted to GA in Kubernetes 1.36 via the KubeletFineGrainedAuthz feature gate).

Instead of lumping every Kubelet endpoint under nodes/proxy, the Kubelet's Webhook authorizer now checks granular subresources before falling back to nodes/proxy:

  • nodes/metrics -> /metrics, /metrics/cadvisor, /metrics/probes, /metrics/resource
  • nodes/stats -> /stats/*
  • nodes/log -> /logs/*
  • nodes/pods -> /pods, /runningpods
  • nodes/healthz -> /healthz
  • nodes/configz -> /configz

None of those six subresources permit /exec, /run, /attach, /portForward, or /debug/pprof. You can now replace nodes/proxy in your Prometheus and observability ClusterRoles with a strictly least-privilege permission set (separating nodes discovery from read-only get on the Kubelet subresources):

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus-kubelet-scraper-hardened
rules:
  - apiGroups: [""]
    resources:
      - nodes
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources:
      - nodes/metrics
      - nodes/stats
      - nodes/pods
      - nodes/healthz
    verbs: ["get"]

Important: KEP-2862 applies when Prometheus scrapes Kubelets directly on port 10250 (the default in modern kube-prometheus-stack ServiceMonitors). If your Prometheus configuration still routes scrapes through kube-apiserver via /api/v1/nodes/<node>:10250/proxy/metrics, kube-apiserver still authorizes that proxy request against nodes/proxy - dropping nodes/proxy will immediately break scraping until you migrate Prometheus to direct :10250 Kubelet scrapes (with TLS verification against the cluster CA).

With nodes/proxy removed from the ClusterRole and Prometheus scraping :10250 directly, any attempt by a compromised monitoring pod to initiate a WebSocket GET against /exec on port 10250 fails the Kubelet's SubjectAccessReview with 403 Forbidden.

Auditing Your Cluster RBAC in Production

Do not wait for an external pentest to discover which ServiceAccounts or Helm charts shipped nodes/proxy, pods/ephemeralcontainers, or secrets list permissions. Run these checks in CI and against live clusters.

1. Hunt Down system:masters and High-Risk Roles with kubectl and jq

# Find every ClusterRoleBinding bound to system:masters or cluster-admin (safely handles null subjects)
kubectl get clusterrolebindings -o json | jq -r '
  .items[]
  | select(
      .roleRef.name == "cluster-admin" or
      any(.subjects[]?; .name == "system:masters")
    )
  | "\(.metadata.name) -> role=\(.roleRef.name) subjects=\((.subjects // []) | map("\(.kind):\(.name)") | join(","))"
'

# Find every Role or ClusterRole granting high-risk resources, wildcards, or escalation verbs
# (handles nonResourceURLs and avoids duplicate lines per matching rule)
kubectl get clusterroles,roles -A -o json | jq -r '
  .items[]
  | . as $role
  | .rules[]?
  | select(
      any(.resources[]?; IN("nodes/proxy", "pods/exec", "pods/ephemeralcontainers", "serviceaccounts/token", "*")) or
      any(.verbs[]?; IN("escalate", "bind", "impersonate", "*"))
    )
  | "\($role.kind)/\($role.metadata.namespace // "cluster")/\($role.metadata.name): verbs=\(.verbs) targets=\(.resources // .nonResourceURLs // [])"
'

2. Query Effective Permissions with kubectl-who-can

The kubectl-who-can plugin (from Aqua Security) resolves group bindings and wildcard rules to show every subject capable of executing a dangerous action:

# Who can execute commands in pods across the cluster?
kubectl who-can create pods/exec --all-namespaces

# Who can attach ephemeral debug containers into running pods?
kubectl who-can patch pods/ephemeralcontainers --all-namespaces
kubectl who-can update pods/ephemeralcontainers --all-namespaces

# Who still holds legacy nodes/proxy GET permissions?
kubectl who-can get nodes/proxy

# Who can list all secrets (and therefore read every secret value)?
kubectl who-can list secrets --all-namespaces

3. Continuous Posture Scanning with Kubescape

Deploy Kubescape (CNCF Incubating) to continuously evaluate your cluster's RBAC graph against the NSA/CISA Kubernetes Hardening Guide and CIS Benchmarks. Kubescape constructs a full graph of ServiceAccounts, RoleBindings, and pod placements to identify toxic combinations (such as an internet-facing pod running with a ServiceAccount that can list secrets or create pods/exec):

kubescape scan framework nsa \
  --include-namespaces kube-system,monitoring,production \
  --format pretty-printer

Operational Pitfalls to Watch For

  • Locking out node registration during aws-auth migration: When switching an existing EKS cluster from CONFIG_MAP to API_AND_CONFIG_MAP and finally API, verify that every worker node IAM role has a corresponding EC2_LINUX (or EC2_WINDOWS) Access Entry created before disabling CONFIG_MAP. Otherwise, Kubelets lose authentication to the API server immediately.
  • OIDC IdP hosted inside the same cluster: On bare metal, if you run Keycloak or Dex inside the Kubernetes cluster whose API server depends on it for human authentication, a CNI outage or storage failure creates a circular dependency: you cannot log into kube-apiserver via OIDC to fix the cluster because Keycloak is down. Always keep either an external IdP replica on a separate management cluster/VM or a tested break-glass procedure (super-admin.conf accessible via out-of-band console).
  • Kubelet Webhook cache TTL during incident response: Kubelets cache positive SubjectAccessReview responses for --authorization-webhook-cache-authorized-ttl (default 5m0s). When you revoke a ClusterRoleBinding for nodes/proxy or nodes/metrics, an active attacker can continue hitting the Kubelet directly for up to five minutes unless you also isolate the pod via NetworkPolicy or delete the pod.

Day-1 Verification & Operational Runbook

Run these checks to verify your human identity and RBAC baseline:

# 1. Confirm no monitoring or tenant roles retain nodes/proxy GET or unexpected exec/debug access
kubectl who-can get nodes/proxy
kubectl who-can create pods/exec --all-namespaces
kubectl who-can patch pods/ephemeralcontainers --all-namespaces

# 2. On AWS EKS, confirm aws-auth is retired (must return "API")
aws eks describe-cluster --name <cluster> --query "cluster.accessConfig.authenticationMode"

# 3. On Azure AKS, confirm static --admin local accounts are disabled (must return true)
az aks show --resource-group <rg> --name <cluster> --query "disableLocalAccounts"

Key Day-2 operational practices:

  • Verify direct :10250 scraping before dropping nodes/proxy: Audit every Prometheus ServiceMonitor and telemetry agent config to confirm scrapes target Kubelet :10250 directly rather than /api/v1/nodes/.../proxy/, then upgrade to Kubernetes 1.36+ and remove nodes/proxy from all monitoring ClusterRoles.
  • Weigh the root-of-trust trade-off on dynamic break-glass engines: Native IdP JIT elevation (IAM Identity Center, GCP PAM, Entra PIM, or hardware-MFA Keycloak emergency clients mapped to oidc:break-glass-admin) requires zero standing cluster credentials. If you instead use OpenBao or HashiCorp Vault's Kubernetes Secrets Engine to mint temporary RoleBindings or short-lived admin ServiceAccount tokens during a P0 incident, recognize that OpenBao itself must hold a privileged bind/token-minting credential - treat OpenBao's authentication and audit path as Tier-0 infrastructure.
  • Gate RBAC regressions continuously: Run kubescape scan framework nsa and the jq escalation audit on a weekly schedule (and on every Helm chart upgrade PR) to alert before any new chart introduces escalate, bind, impersonate, nodes/proxy, pods/ephemeralcontainers, or wildcard verbs.

Series Navigation