LogoLogo
  • Intro
  • Pre-engagement
  • General methodology
  • OSCP Templates
  • Recon
    • Active
    • Passive OSINT
  • Attack Types
  • Network
    • Linux
    • Windows
    • Active Directory Enumeration
  • Shells
  • Port Forwarding / SSH Tunneling
  • Transferring files
  • Web
  • SQL
  • Password cracking
    • Brute Force - CheatSheet
  • Useful Linux Commands
  • Android
  • Buffer Overflow
  • TCP Dump and Wireshark Commands
  • Cloud Pentesting
    • SQL vs NoSQL Cheetsheet Cloud
    • AWS cli cheatsheet
    • Tools to install
    • Enumeration
    • Cloudgoat
  • Privilege Escalation
    • Linux
      • Loot
    • Windows
      • Loot
  • Kali Configuration
    • My bash Profile Files
    • Terminator Configuration
    • Tmux Configuration
    • Fish Config
    • Useful things to Install
    • VSCode Configuration
  • Automated
    • Tools
  • Videos
    • My Youtube Channel
    • IppSec Videos
    • The Cyber Mentor
  • VMs Similar to OSCP
    • Machines Similar to OSCP
  • Search Ippsec's Videos
    • Search Ippsec's Videos
  • Pcap Analysis
    • Pcap analysis
    • RegEx
  • MSFvenom Cheetsheet
  • Support me
  • Donate
Powered by GitBook
On this page
  • Check for common s3 bucket misconfigurations
  • Different Types of Access Keys
  • Get Snapshots

Was this helpful?

  1. Cloud Pentesting

Enumeration

Last updated 3 years ago

Was this helpful?

Check if the resolved domain contains the word "website".

You can access the static website at: flaws.cloud.s3-website-us-west-2.amazonaws.com or the bucket at: flaws.cloud.s3-us-west-2.amazonaws.com.

If you try to access a bucket but specify a different region in the domain name (for example, the bucket is in bucket.s3.amazonaws.com but you are trying to access bucket.s3-website-us-west-2.amazonaws.com), you will be redirected to the correct location.

Test to see if a website is hosted in an s3 bucket

dig +nocmd flaws.cloud any +multiline +noall +answer

Put IP in browser - it will redirect to AWS console s3 page.

Run nslookup on the IP to get the AWS s3 website

The site flaws.cloud is hosted as an S3 bucket. This is a great way to host a static site, similar to hosting one via github pages. Some interesting facts about S3 hosting: When hosting a site as an S3 bucket, the bucket name (flaws.cloud) must match the domain name (flaws.cloud). Also, S3 buckets are a global name space, meaning two people cannot have buckets with the same name. The result of this is you could create a bucket named apple.com and Apple would never be able host their main site via S3 hosting.

Check for common s3 bucket misconfigurations

/bucketflaws.sh -u flaws.cloud -o -p -d

Using the AWS cli

aws s3 ls  s3://flaws.cloud/ --no-sign-request --region us-west-2

Will list the files in the bucket

Different Types of Access Keys

AKIAJ366LIPB4IJKT7SA = long term access key - note the AKIA

ASIAJ366LIJGULDN21D = session access key - note the ASIA

Get Snapshots

AWS allows you to take snapshots of EC2 and databases (RDS). The main purpose for this is to create backup copies, but sometimes users use snapshots to regain access to their own EC2s if they forget passwords.

AWS allows you to take snapshots of EC2 and databases (RDS). The main purpose for this is to create backups, but sometimes people use snapshots to regain access to their own EC2s if they forget passwords. This also allows attackers to get access to things. Snapshots are usually limited to your own account. So a possible attack would be for an attacker to get access to an AWS key that allows them to start/stop EC2s and do other things to EC2s, and then use that to take a snapshot of an EC2 and start an EC2 with that volume in your environment to gain access to it. As with all backups, you need to be careful to protect them.

Look for snapshots that this user has access to (note the SnapshotId):

remember to include the --owner-id else you will get a lot of output that is not relevant

aws ec2 describe-snapshots --profile flaws3 --owner-id 975426262029 --region us-west-2
aws ec2 create-volume --profile default --availability-zone us-west-2a --region us-west-2 --snapshot-id snap-0b49342abd1bdcb89    

run lsblk to see if disk is attached

Then run sudo mount /dev/xvdf1 /mnt to mount the drive, browse to /mnt to view snapshot disk

You can also list the files by going to

http://flaws.cloud.s3.amazonaws.com/
get IP address
S3 bucket with "Everyone" having "List" permissions
get SnapshotId
launch an ec2 instance and attach the volume