Cloud Team Detects Kubernetes-to-AWS Privilege Escalation Through Contextual Investigation

· Original article ↗

Summary

A cloud response team traced suspicious AWS activity to an exploited application on an EC2 instance, where Kubernetes pod access to IMDS enabled attackers to take over the instance’s IAM role.

Key points

  • An EC2 instance IAM role was used from an irregular source IP and then queried multiple EC2 instances and Security Groups.
  • Environmental baselines helped identify the role as belonging to an EC2 instance running an EKS pod, making otherwise potentially routine actions suspicious.
  • CloudTrail, VPC Flow logs, and host forensic evidence linked the activity to an exposed application and subsequent access to the Instance Metadata Service (IMDS).
  • A recently published remote-code-execution vulnerability in the application had reportedly been exploited hours before the IAM role was compromised.
  • A newly deployed internet-facing service shared a subnet and Security Group with the vulnerable application, changing its exposure.
  • The case study emphasizes contextual detection, rapid investigation, vulnerability management, and production application segregation.

Article Details

Defense Focus
Detect and rapidly investigate privilege escalation from a Kubernetes pod or EC2 instance to AWS control-plane access, using environment-specific behavioral baselines and cross-cloud context.
Detection Methods
  • Flag an EC2 instance IAM role being used from an irregular source IP address.
  • Detect reconnaissance when the role queries multiple EC2 instances and Security Groups, and assess the activity against environmental inventory baselines.
  • Correlate role activity with the instance and EKS pod associated with that role.
  • Investigate whether the Instance Metadata Service was accessed shortly before the reconnaissance activity.
Data Sources
  • CloudTrail logs
  • VPC Flow logs
  • EC2 instance forensic artifacts
  • Local OS logs
  • Environmental inventory baselines
Platforms
  • AWS
  • EKS
Defensive Actions
  • Triage anomalous role activity to determine whether it has a legitimate explanation, then rapidly investigate potential compromise.
  • Review and restrict Kubernetes pod access to the host EC2 instance's Instance Metadata Service.
  • Apply vulnerability management to open-source applications, especially newly disclosed vulnerabilities.
  • Segregate production applications and avoid placing an internet-facing service in a subnet where it can lead to exposure of a vulnerable application through shared Security Group changes.

MITRE ATT&CK

Vendors

Products

Related Articles