π [Security Issue] metric-adapter ClusterRole grants full cluster-wide privileges
The current configuration of the metric-adapter component defines an overly permissive ClusterRole and applies it directly to a running pod through a ServiceAccount and ClusterRoleBinding. This creates a critical security risk where compromising a single pod could lead to complete cluster takeover.
π Misconfigured RBAC Flow with Source Links
1οΈβ£ Overprivileged ClusterRole definition
π rbac.yaml lines 1β8
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metric-adapter # <-- (A) overly permissive role
rules:
- apiGroups: [ "*" ]
resources: [ "*" ]
verbs: [ "*" ]
This ClusterRole grants full access to all API groups, resources, and actions, including reading secrets, modifying configurations, deleting deployments, and more.
2οΈβ£ Binding the ClusterRole to a ServiceAccount
π rbac.yaml lines 100β111
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metric-adapter
roleRef:
kind: ClusterRole
name: metric-adapter # <-- (A) reference to the powerful role
subjects:
- kind: ServiceAccount
name: metric-adapter # <-- (B) service account that receives the permissions
namespace: crane-system
This binding gives full cluster access to the metric-adapter ServiceAccount.
3οΈβ£ ServiceAccount Definition
π deployment.yaml lines 1β5
apiVersion: v1
kind: ServiceAccount
metadata:
name: metric-adapter # <-- (B) defined ServiceAccount
namespace: crane-system
The above ServiceAccount is the subject of the previous ClusterRoleBinding.
4οΈβ£ ServiceAccount Used in Deployment
π deployment.yaml line 27
spec:
template:
spec:
serviceAccountName: metric-adapter # <-- (B) the privileged ServiceAccount in use
containers:
- name: metric-adapter
image: docker.io/gocrane/metric-adapter:v0.10.0
The metric-adapter pod is now running with cluster-admin equivalent privileges.
β οΈ Realistic Threat Scenarios
| Scenario |
Description |
| Pod Compromise β Cluster Takeover |
If the metric-adapter pod is compromised via a vulnerability, the attacker gains full control of the cluster. |
| Secrets Exfiltration |
Attacker can access all secrets in all namespaces, including kube-system. |
| RBAC Abuse |
The attacker can grant themselves or other pods more privileges, create backdoors, or modify policies. |
| Workload Tampering |
Delete or modify other workloads, inject malicious deployments, or affect critical services. |
| Lateral Movement |
Pivot into internal services such as Prometheus, databases, or private applications. |
β
Recommendations
- Replace the wildcard-based ClusterRole with a least privilege policy:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metric-adapter
rules:
- apiGroups: ["custom.metrics.k8s.io"]
resources: ["*"]
verbs: ["get", "list", "watch"]
-
If possible, switch from a ClusterRole to a namespace-scoped Role and use RoleBinding instead.
-
Audit and remove duplicate or unnecessary RBAC definitions. Add CI security checks (e.g., using Polaris, OPA Gatekeeper, or kubeaudit).
π¨ Suggested Action
This is a critical security vulnerability where a single container exploit could lead to full cluster compromise.
It is strongly recommended that the team opens a pull request (PR) immediately to address this misconfiguration.
π [Security Issue]
metric-adapterClusterRole grants full cluster-wide privilegesThe current configuration of the
metric-adaptercomponent defines an overly permissive ClusterRole and applies it directly to a running pod through a ServiceAccount and ClusterRoleBinding. This creates a critical security risk where compromising a single pod could lead to complete cluster takeover.π Misconfigured RBAC Flow with Source Links
1οΈβ£ Overprivileged
ClusterRoledefinitionπ
rbac.yamllines 1β82οΈβ£ Binding the ClusterRole to a ServiceAccount
π
rbac.yamllines 100β1113οΈβ£ ServiceAccount Definition
π
deployment.yamllines 1β54οΈβ£ ServiceAccount Used in Deployment
π
deployment.yamlline 27β Recommendations
If possible, switch from a ClusterRole to a namespace-scoped Role and use RoleBinding instead.
Audit and remove duplicate or unnecessary RBAC definitions. Add CI security checks (e.g., using Polaris, OPA Gatekeeper, or kubeaudit).
π¨ Suggested Action
This is a critical security vulnerability where a single container exploit could lead to full cluster compromise.
It is strongly recommended that the team opens a pull request (PR) immediately to address this misconfiguration.