Home

Awesome

<p align="center"> <img src="https://cloud.githubusercontent.com/assets/4115778/24827505/eab7322a-1c42-11e7-96f3-dbc772da5f10.png" width="70%" alt="Sandcastle logo - AWS S3 bucket enumeration">

Inspired by a conversation with Instacart's @nickelser on HackerOne, I've optimised and published Sandcastle – a Python script for AWS S3 bucket enumeration, formerly known as bucketCrawler.

The script takes a target's name as the stem argument (e.g. shopify) and iterates through a file of bucket name permutations, such as the ones below:

-training
-bucket
_dev
_attachments
.photos
.elasticsearch
[...]

Getting started

Detailed installation and usage instructions in Spanish:

https://medium.com/@enanosca/enumeraci%C3%B3n-de-aws-s3-buckets-con-sandcastle-d8154f45a540

Here's how to get started:

  1. Clone this repo
  2. Run sandcastle.py with a target name or list of targets
  3. Matching bucket permutations will be identified, and read/write permissions tested.
usage: sandcastle.py [-h] (-t targetStem | -f inputFile) [-b bucketFile]
                     [-o outputFile] [--threads threadCount]

arguments:
  -h, --help            show this help message and exit
  -t shopify, --target shopify
                        Select a target stem name (e.g. 'shopify')
  -f targets.txt, --file targets.txt
                        Select a target list file
  -b bucket-names.txt, --bucket-list bucket-names.txt
                        Select a bucket permutation file (default: bucket-
                        names.txt)
  -o output.txt, --output output.txt
                        Select a output file
  --threads 50
                        Choose number of threads (default=50)
   ____             __             __  __
  / __/__ ____  ___/ /______ ____ / /_/ /__
 _\ \/ _ `/ _ \/ _  / __/ _ `(_-</ __/ / -_)
/___/\_,_/_//_/\_,_/\__/\_,_/___/\__/_/\__/

S3 bucket enumeration // release v1.3 // ysx & Parasimpaticki


[*] Commencing enumeration of 'spotify', reading 2125 lines from 'bucket-names.txt'.

[+] Checking potential match: shopify-content --> 403

An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied

Status codes and testing

Status codeDefinitionNotes
404Bucket Not FoundNot a target for analysis (hidden by default)
403Access DeniedPotential target for analysis via the CLI
200Publicly AccessiblePotential target for analysis via the CLI

AWS CLI commands

Here's a quick reference of some useful AWS CLI commands:

What is S3?

From the Amazon documentation, Working with Amazon S3 Buckets:

Amazon S3 [Simple Storage Service] is cloud storage for the Internet. To upload your data (photos, videos, documents etc.), you first create a bucket in one of the AWS Regions. You can then upload any number of objects to the bucket.

In terms of implementation, buckets and objects are resources, and Amazon S3 provides APIs for you to manage them.

Closing remarks