Absuing Amazon VPC CNI Plugin For Kubernetes
The default Amazon EKS node group IAM role carries the AmazonEKS_CNI_Policy, which grants EC2 network-interface actions on all resources with no conditions. An attacker with a foothold in the cluster could take that role and detach or attach network interfaces to reach services in other VPCs.
Published on elttam.com
Would you expect an Amazon EKS cluster to be able to manipulate the networking of other EC2 instances, unrelated to the cluster, even those in other VPCs?While considering the attack surface exposed for Amazon EKS, we investigated the Amazon VPC CNI plugin for Kubernetes, and identified methods to abuse the plugin to…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the default node group IAM role is attached to the AmazonEKS_CNI_Policy, which allows network-interface actions on all resources with no restricting conditions, and pods can read that role from the instance metadata service.
Impact
An attacker could expose and potentially exploit services in other VPCs and move laterally, though detaching an in-use interface is disruptive and only secondary interfaces can be moved.
What the attacker needed
Foothold in an EKS cluster; default node group IAM role reachable; target ENI in another VPC
The fix
The cluster should be hardened by using IAM roles for service accounts, blocking pod access to the instance metadata service, and scoping down the CNI IAM policy.
How it was found
- Gain a foothold in the EKS cluster, for example through a container escape, and obtain the node group's IAM role.
- Enumerate EC2 instances and network interfaces to find a target in another VPC.
- Pick a secondary interface with a public address whose security group allows traffic from the cluster.
- Detach that interface from its current instance.
- Attach the interface to the target instance in the other VPC.
- Connect to the exposed service from the cluster container.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Kubernetes clusters on AWS run on virtual machines, and each machine has an identity (an IAM role) that lets it call AWS services. The default setup gives that identity broad permission to rewire network cards (network interfaces) for any machine in the AWS account, not just the cluster's own. So someone who breaks into one container can borrow that identity and plug a network card into a machine in another network, then reach services that were meant to be isolated.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.