0xSearches/sandcastle
GitHub: 0xSearches/sandcastle
基于 Python 的 AWS S3 存储桶枚举工具,通过目标名称与变体词表组合发现并检测存储桶访问权限。
Stars: 144 | Forks: 59
灵感源自与 Instacart 的 [@nickelser](https://github.com/nickelser) 在 HackerOne 上的一次对话,我优化并发布了 Sandcastle —— 一个用于 AWS S3 bucket 枚举的 Python 脚本,前身是 bucketCrawler。
该脚本将目标名称作为主参数(例如 `shopify`),并遍历包含 bucket 名称变体的文件,如下所示:
```
-training
-bucket
-dev
-attachments
-photos
-elasticsearch
[...]
```
## 开始使用
入门步骤如下:
1. 克隆此仓库(PyPi 分发暂时禁用)。
2. 使用目标名称和输入文件运行 `sandcastle.py`(可从此仓库获取示例)
3. 匹配的 bucket 变体将被识别,并测试读取权限。
```
usage: sandcastle.py [-h] -t targetStem [-f inputFile]
arguments:
-h, --help show this help message and exit
-t targetStem, --target targetStem
Select a target stem name (e.g. 'shopify')
-f inputFile, --file inputFile
Select a bucket permutation file (default: bucket-
names.txt)
```
```
____ __ __ __
/ __/__ ____ ___/ /______ ____ / /_/ /__
_\ \/ _ `/ _ \/ _ / __/ _ `(_- __/ / -_)
/___/\_,_/_//_/\_,_/\__/\_,_/___/\__/_/\__/
S3 bucket enumeration // release v1.2.4 // ysx
[*] Commencing enumeration of 'shopify', reading 138 lines from 'bucket-names.txt'.
[+] Checking potential match: shopify-content --> 403
An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
```
### 状态码与测试
| 状态码 | 定义 | 备注 |
| ------------- | ------------- | -----|
| 404 | Bucket 未找到 | 非分析目标(默认隐藏)|
| 403 | 访问被拒绝 | 可通过 CLI 进行分析的目标 |
| 200 | 公开可访问 | 可通过 CLI 进行分析的目标 |
### AWS CLI 命令
以下是一些有用的 AWS CLI 命令的快速参考:
* 列出文件:`aws s3 ls s3://bucket-name`
* 下载文件:`aws s3 cp s3://bucket-name/