EC2 - Elastic Compute Cloud

EC2 Enumeration and Exploitation

Amazon Elastic Compute Cloud (EC2) offers broad support for computing, with over 750 instance types and numerous types of available processors, storage, networking, and operating systems.

Enumeration

Describes the information about all instances

aws ec2 describe-instances

Describes the information about specified instance

aws ec2 describe-instances --instance-ids [instace-id]

Describes the information about UserData Attribute of the specified Instance

aws ec2 describe-instance-attribute --atribute userData --instance-id [instance-id]

Describes the infroamtion about IAM instance profile associations

aws ec2 describe-iam-instance-profile-associations

Exploitation

SSRF/RCE

SSRF / RCE

AWS Metadata

  • IMDV1

  • IMDV2

AWS Userdata

  • IMDV1

  • IMDV2

EC2StepShell

Persistence

Generate SSH key pair

On EC2 instance, add private key to user ssh directory

Access EC2 using ssh backdoor key

Privilege Escalation

EC2 acting as a reverse-proxy

SSRF / RCE

Enumerating EC2s / EBS

Snapshots ?

Exploit snapshot

EBS - Elastic Block Store

Snapshot found

  1. Launch a ec2 instance (create ssh key pair)

  2. Attach the snapshot created to the ec2 instance

Connect to the instance and mount the snapshot

EC2 - Get Password

Templates

Interesting Book

Interesting Books

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

Last updated