When people talk about metadata abuse, many automatically think of AWS IMDSv1. In Kubernetes the pattern is broader: there are internal “metadata services” (ServiceAccount tokens and node endpoints like kubelet) and, in addition, the classic cloud provider metadata IP (169.254.169.254) is often one network hop away from a Pod if it is not controlled.
In real incidents, the attacker does not need to “break Kubernetes” to escalate: it is enough to land in a Pod (RCE, vulnerable dependency, leaked credentials) and take advantage of what the environment already exposes by default. From there, the typical jump is identity: going from executing code in a container to obtaining valid credentials to talk to the Kubernetes API or even the cloud provider API (for example via IRSA or Workload Identity).
Abuse surface: metadata in Kubernetes is not a single endpoint
In Kubernetes, several sources of “metadata” coexist that end up being sensitive material: the ServiceAccount token mounted in the Pod filesystem, the kubelet endpoints on the node, and the cloud provider’s metadata service. Each one has different controls, and the typical corporate mistake is to protect one (for example, block IMDS) while leaving another open (for example, automounted tokens or kubelet accessible from pods).
This nuance matters because the attacker chooses the cheapest path. If in a cluster the NetworkPolicy blocks 169.254.169.254 but the ServiceAccount token has broad permissions (or there is lax RBAC in some namespace), escalation comes through the Kubernetes API. And if RBAC is reasonably constrained but kubelet exposes useful or poorly secured endpoints, the pivot can go toward the node. In both cases, “metadata abuse” is the catalyst: identity or control over the execution plane.
The consequence in enterprises is often silent lateral movement: the attacker does not “take down” the cluster, but uses legitimate credentials to enumerate secrets, deploy collection pods, or access buckets/queues through cloud integrations. That movement shows up in logs as normal activity if it is not instrumented correctly.
From Pod to credentials: abuse of the ServiceAccount Token mounted by default
In many clusters, Pods still start with a ServiceAccount JWT token automatically mounted. For an attacker inside the container, that means the identity to call the Kubernetes API is already available with no effort: it is reading a file and testing permissions. If the ServiceAccount has excessive RBAC (common in “legacy” workloads or in tooling namespaces), the attacker can list secrets, read ConfigMaps with internal endpoints, or create new Pods with privileges.
In corporate environments the typical impact is not theoretical: a single ServiceAccount with broad read permissions can exfiltrate database credentials or third-party tokens stored as a Secret. And if there is also create permission on Pods/Deployments in a namespace with node tolerations/affinity, the attacker can schedule loads that facilitate pivoting, persistence, or data extraction. All with legitimate calls to the API Server, which in audit look like “normal operation” if the baseline is not clear.
- Operational signal: anomalous API calls from a Pod
In practice, when a Pod that should only talk to a database starts doing list of Secrets or watch on cluster resources, the difference is detected in audit if verbs and resources are reviewed by identity. If there is no audit or it is not correlated with the expected deployment, it is lost as noise.
- Business consequence: “clean” escalation without exploiting cluster CVEs
The attacker does not need a Kubernetes exploit: the combination of an automounted token + over-permissive RBAC is enough. This is especially frequent when a “generic” ServiceAccount is reused for multiple deployments or when access is granted for convenience (for example, “read secrets to avoid managing variables”).
Kubelet as the node’s “metadata service”: why it matters from a Pod
Alongside the ServiceAccount token, kubelet exposes an API on the node that, depending on configuration, may be accessible from Pods on the same node network. In incomplete hardening scenarios, that API becomes another “metadata” service because it delivers sensitive information about the node or the state of Pods, and in certain cases can facilitate actions that bring the attacker closer to node-level execution.
The problem in enterprises often shows up as a “design gap” between teams: platform assumes the internal cluster network is trusted; security assumes namespace isolation is enough; and operations needs visibility and enables accesses that then remain permanent. An attacker inside a Pod takes advantage of that reality: the jump from container to node is rarely a single critical bug, rather a chain of allowed accesses plus permissive configurations.
If kubelet is improperly exposed, the attacker can obtain inventory information (what nodes exist, what workloads run, what images, what mounts) that accelerates targeting. In incidents, that information drastically reduces reconnaissance time and makes subsequent escalation more efficient, even if the “final blow” is via another path.
IMDS (169.254.169.254) does not disappear in Kubernetes: IRSA and Workload Identity as a target
Blocking IMDSv1 does not solve the pattern if 169.254.169.254 is still reachable from Pods. In Kubernetes, the attacker’s real objective is usually to obtain valid cloud credentials, and modern mechanisms (IRSA on AWS, Workload Identity on GCP, etc.) may end up depending on metadata or on flows that the attacker can try to trigger from a compromised Pod.
In AWS with IRSA, the Pod obtains credentials from a web token (projected or mounted) and an IAM role with trust to the cluster’s OIDC. The attacker does not “steal the account”, but can use the credentials of the role associated with the ServiceAccount, which in many environments has permissions over S3, SQS, KMS, or internal APIs. It is a particularly damaging abuse because the resulting access happens outside the cluster: it is no longer an incident “only Kubernetes”, it is a cloud incident.
How to do it in practice (validation and hardening in AWS with IRSA)
- Review the trust policy of the IAM role associated with the ServiceAccount
Verify that the condition strictly limits the sub to the expected ServiceAccount and namespace, and that aud is the one for STS. A typical example of a correct trust policy (adjust OIDC_PROVIDER, namespace, and ServiceAccount):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"Federated": "arn:aws:iam::123456789012:oidc-provider/OIDC_PROVIDER"},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"OIDC_PROVIDER:sub": "system:serviceaccount:mi-namespace:mi-serviceaccount",
"OIDC_PROVIDER:aud": "sts.amazonaws.com"
}
}
}
]
}
- Validate from AWS that the role is only assumed from the expected subject
In CloudTrail, review AssumeRoleWithWebIdentity events and contrast sessionContext/principalId with the expected OIDC pattern. In daily operations, any sudden increase in assumptions from a stable workload or assumptions from unplanned namespaces is a sign of abuse or configuration drift.
- Reduce role permissions to what is strictly necessary
If the role has broad permissions “just in case”, the attacker turns it into a direct bridge to data. In incidents, roles with read permissions on S3 or access to secrets (for example, via KMS or Secrets Manager) have been the fastest path to exfiltration without needing persistence inside the cluster.
Recommendations for corporate environments
The pattern to assume is simple: if an attacker gets into a Pod, they will look for identity and “free” network routes. In Kubernetes, that is usually the ServiceAccount Token mounted by default, internal node endpoints (like kubelet, depending on exposure), and access to 169.254.169.254 when it exists. The goal is not to “break the cluster”, it is to obtain legitimate credentials to move with less friction and less detection.
In practice, effective mitigations are usually operable and measurable. Disabling token automount where it is not needed drastically reduces the blast radius of an RCE inside a Pod. And blocking access to 169.254.169.254 via NetworkPolicies prevents an application compromise from turning into cloud credentials via the short path. When RBAC with least privilege is also maintained and IRSA/Workload Identity roles with strict trust policies are used, the attacker is left without high-value exploitable “metadata”.
The key point for corporate teams is to treat “metadata” as an attack surface, not as a platform detail. If you control what identities are injected into Pods and what network destinations they can reach, you cut off most abuse chains before they reach data or control of the environment.
Interested in Cloud Security?
Technical analysis, hands-on labs and real-world cloud security insights.