Anatomy of a Cloud Native Attack: How We Pwned Kubernetes for $100k
A PDF generation feature accepted arbitrary URLs, allowing SSRF to the AWS metadata service and theft of node IAM credentials. The attackers then used those credentials to access the Kubelet API, deploy a privileged pod, steal a highly privileged service account token, and gain cluster-admin access.
infosecwriteups.com
Published on infosecwriteups.com
Ever wondered how a tiny, seemingly harmless bug can unravel an entire cloud infrastructure? You’re in the right place.
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 PDF generator did not validate or restrict the URLs it fetched, and the cloud and Kubernetes configurations were overly permissive (metadata service reachable, Kubelet weakly authenticated, over-privileged service accounts).
Impact
The attackers could read all secrets, deploy pods anywhere, and effectively take full control of the Kubernetes cluster, though the text notes that enforcing IMDSv2 or other defences would have broken the chain.
What the attacker needed
Access to the PDF export feature; ability to supply a URL; cloud metadata service reachable; Kubelet API weakly authenticated
The fix
The issues were fixed promptly after responsible disclosure, and the text recommends blocking SSRF, enforcing IMDSv2, locking down Kubelet authentication, applying least privilege, and using network policies.
How it was found
- Send a request to the PDF generation endpoint with a URL pointing to the AWS metadata service.
- Use the SSRF to fetch the IAM role name and then the temporary credentials for that role.
- Configure the stolen AWS keys locally and use AWS SSM to port-forward the node's Kubelet API port to the local machine.
- Query the Kubelet API to list pods and use the /run endpoint to execute a reverse shell inside a container.
- From the shell, read the service account token of a highly privileged pod (monitoring-god) that has wildcard secret access.
- Use that token to read the cluster-admin service account token from kube-system and configure kubectl to use it, achieving full cluster control.
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.
The PDF export tool let users supply a web address, and the server fetched it without checking whether it pointed to internal systems. Attackers pointed it at a special cloud address that hands out temporary passwords, then used those to break into the Kubernetes cluster that runs the applications.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.