AWS - EC2 Unauthenticated Enum

Reading time: 3 minutes

tip

Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE) Apprenez et pratiquez le hacking Azure : HackTricks Training Azure Red Team Expert (AzRTE)

Soutenir HackTricks

EC2 & services associés

Check in this page more information about this:

AWS - EC2, EBS, ELB, SSM, VPC & VPN Enum

Ports publics

Il est possible d'exposer n'importe quel port des machines virtuelles sur Internet. Selon ce qui tourne sur le port exposé, un attaquant pourrait l'exploiter.

SSRF

Cloud SSRF - HackTricks

AMIs publics & EBS Snapshots

AWS permet de permettre à n'importe qui de télécharger des AMIs et des Snapshots. Vous pouvez lister ces ressources très facilement depuis votre propre compte:

bash
# Public AMIs
aws ec2 describe-images --executable-users all

## Search AMI by ownerID
aws ec2 describe-images --executable-users all --query 'Images[?contains(ImageLocation, `967541184254/`) == `true`]'

## Search AMI by substr ("shared" in the example)
aws ec2 describe-images --executable-users all --query 'Images[?contains(ImageLocation, `shared`) == `true`]'

# Public EBS snapshots (hard-drive copies)
aws ec2 describe-snapshots --restorable-by-user-ids all
aws ec2 describe-snapshots --restorable-by-user-ids all | jq '.Snapshots[] | select(.OwnerId == "099720109477")'

Si vous trouvez un snapshot restaurable par n'importe qui, assurez-vous de consulter AWS - EBS Snapshot Dump pour des instructions sur le downloading et le looting du snapshot.

Modèle d'URL publique

bash
# EC2
ec2-{ip-seperated}.compute-1.amazonaws.com
# ELB
http://{user_provided}-{random_id}.{region}.elb.amazonaws.com:80/443
https://{user_provided}-{random_id}.{region}.elb.amazonaws.com

Énumérer les instances EC2 avec adresse IP publique

bash
aws ec2 describe-instances --query "Reservations[].Instances[?PublicIpAddress!=null].PublicIpAddress" --output text

tip

Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE) Apprenez et pratiquez le hacking Azure : HackTricks Training Azure Red Team Expert (AzRTE)

Soutenir HackTricks