Pivot into EKS from a Leaked Key
Walk a single leaked, over-scoped IAM key across the AWS and Kubernetes trust boundary to the production customer database
Overview
ShopNest moved its order pipeline onto Amazon EKS, and a developer committed an AWS access key to a public mirror of the shopnest-infra repository. You recovered that key during reconnaissance. It belongs to a continuous-integration deployer named dev-ci, and on the surface it looks nearly useless, because almost every AWS call it makes is denied.
You determine what that single over-scoped identity can still reach, cross from AWS IAM into Kubernetes through an EKS Access Entry, escalate inside the cluster by running a controller-created pod as a privileged automation account, cross back into AWS through that account's federated role, and prove material impact by reaching ShopNest's production customer data. The lab also suits a CTF approach.
Objectives
Determine what a single over-scoped, leaked IAM key can reach, pivot from AWS into EKS and back through the IAM and Kubernetes trust boundary, and prove material impact by demonstrating access to ShopNest's production customer data.
Prerequisites
- Familiarity with the AWS Command Line Interface and IAM identities
- Comfort running kubectl against a Kubernetes cluster
- Understanding of Kubernetes namespaces, service accounts, and Role-Based Access Control
- Intro-level knowledge of how containerized workloads obtain AWS credentials, specifically IAM Roles for Service Accounts
Learning outcomes
- Enumerate the permissions of an unknown IAM identity using a permission brute-forcer
- Discover that a low-privilege key's only reachable surface is an EKS cluster
- Identify an EKS Access Entry that maps an IAM principal into a Kubernetes group
- Authenticate to the Kubernetes API across the AWS-to-Kubernetes trust boundary
- Brute-force an accessible namespace you cannot list using k8scout recon
- Enumerate namespace workloads to locate a privileged automation service account
- Exploit a workload controller to run a pod as another service account when direct pod creation is denied
- Leverage IAM Roles for Service Accounts to obtain AWS credentials from a hijacked workload
- Extract a hijacked role's temporary credentials from a pod and enumerate its permissions
- Discover a target secret by name through Secrets Manager enumeration and retrieve it
- Mint a service account token through the TokenRequest API as an alternate credential path
- Exfiltrate customer data from an internal ClusterIP-only datastore
Real-world context
Kubernetes compromises rarely begin with a control-plane zero-day. Attackers typically inherit an over-scoped identity and walk the seams between AWS IAM and Kubernetes RBAC. Two patterns drive most EKS incidents. First, EKS Access Entries and IAM Roles for Service Accounts form a bidirectional trust bridge, and when either side is mapped too broadly, an attacker who lands on one side reaches the other.
Second, the ability to create workloads is frequently treated as a benign developer convenience, when in practice anyone who can create a Deployment or Job can run a pod under any service account in that namespace and inherit its permissions, including any AWS role that service account is federated to. Both patterns appear in published cloud incident reports and in the Kubernetes project's own threat model.