Skip to content
RCE Write-up Advanced

Defeating Kubernetes Privilege Escalation: A Cloud Detection & Response Case Study

An attacker exploited a remote code execution vulnerability in an internet-facing application to access the EC2 instance metadata service and steal the instance's IAM role credentials. The attacker then used those credentials to perform reconnaissance across EC2 instances and security groups.

Yotam Meitar Follow

Published on wiz.io

Attackers are constantly searching for new ways to target cloud environments and escalate initial access into full administrative privileges.

Yotam Meitar, on wiz.io

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 combination of an unpatched remote code execution vulnerability in an internet-facing application and the default configuration that allowed EKS pods to access the instance metadata service (IMDS) without restriction.

Impact

The attacker could escalate from machine access to control of the IAM role and perform reconnaissance across EC2 instances and security groups, potentially leading to further compromise.

What the attacker needed

Vulnerable application exposed to internet; EKS pods allowed to access IMDS; security group misconfiguration

How it was found

  1. An internet-facing service was deployed to the same subnet as the vulnerable application, causing the security group to allow internet access.
  2. A scan exploited the remote code execution vulnerability in the open-source application.
  3. The attacker accessed the Instance Metadata Service from the compromised instance to obtain IAM role credentials.
  4. The attacker used the IAM role to query multiple EC2 instances and security groups for reconnaissance.

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.

A cloud server (EC2 instance) has a digital identity (IAM role) that grants permissions. The attacker found a bug in a web app running on that server, used it to run their own commands, and then asked the server's internal metadata service for the identity's credentials. With those credentials, the attacker could look around at other servers and security settings.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Yotam Meitar

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.