EC2

Attacking EC2 instances: user-data secrets and code, the attached instance profile and its role, and data recovery from EBS snapshots and shared AMIs.

1분 분량2026년 10월 7일 업데이트florianamette기여자 1명
어시스턴트에게 묻기 (MCP)GitHub에서 편집

EC2 is the richest compute surface in AWS because an instance ties together a role (the instance profile), a boot script (user data), and persistent disks (EBS volumes and the AMIs and snapshots they come from). Each is a separate way in: steal the role from the metadata service, read secrets left in user data, or recover another instance's data from a snapshot you can mount.

What folds in here#

  • User data: reading boot scripts for secrets, or setting user data to run code on the next boot.
  • Instance profile: harvesting the attached role's credentials from the metadata service.
  • Snapshots: creating, sharing, and mounting EBS snapshots to read volumes offline.
  • AMI: secrets baked into shared or public machine images, and launching from them.

Launching a new instance with a passed role is a privilege-escalation path and lives under identity PassRole; the pages here cover instances that already exist.

References#