IrondiUg/External_Attack_Surface_Management
GitHub: IrondiUg/External_Attack_Surface_Management
一款集成化的外部攻击面管理工具,通过编排Subfinder和Nuclei等安全工具,实现从子域名发现到漏洞评估的自动化扫描流水线。
Stars: 0 | Forks: 0
## 外部攻击面管理 (EASM) 工具
## 概述
现代组织通过采用云服务、第三方集成、快速部署、影子 IT、被遗忘的基础设施、临时环境以及不受管理的面向互联网的服务,不断扩大其外部数字足迹。
大多数安全团队并未对这些资产保持完全的可见性。
攻击者正是利用了这一盲区。
一个被遗忘的子域名、暴露的 S3 存储桶、废弃的测试服务器、泄露的凭证文件或配置错误的公共服务都可能成为:
- 初始访问向量,
- 勒索软件的入口点,
- 数据泄露的源头,
- 钓鱼基础设施的宿主,
- 或全面的供应链入侵。
开发此项目旨在赶在威胁参与者之前,`主动`且`极具侵略性地`发现这些暴露问题。
### 战略安全目标
该项目旨在帮助组织:
- 检测未知且不受管理的面向互联网的基础设施
- 减少外部攻击面暴露
- 识别高风险的云配置错误
- 发现外部可访问的脆弱服务
- 在影子 IT 成为攻击向量之前将其暴露
- 提高分布式基础设施的安全可见性
- 加速修复优先级的排序
- 强化主动网络防御行动
- 减少外部基础设施中的运营盲点
- 最大程度降低由外部发起入侵的可能性
### 核心运营能力
**外部资产发现**
- 通过跨多个情报源的被动侦察,持续识别公开暴露的组织基础设施。
**DNS 情报验证**
- 判断发现的资产是否处于运行、废弃、非活动或外部可访问状态。
HTTP 服务指纹识别
- 对暴露的服务、技术、框架、Web 服务器、SSL 行为、重定向和应用栈进行画像分析,以识别潜在的脆弱技术和外部暴露的平台。
**云暴露检测**
- 检测公开暴露的 Amazon S3 存储桶、敏感文件泄露、存储桶配置错误,以及可能导致以下情况的潜在未经身份验证的写入访问权限:
- 恶意文件托管,
- 钓鱼部署,
- 恶意软件分发,
- 或数据篡改。
**自动化漏洞评估**
- 使用针对以下内容的 Nuclei 社区模板执行高速漏洞发现:
已知 CVE,
- 云暴露弱点,
- 子域名接管条件,
- 默认凭证,
- Web 应用程序缺陷,
- 以及基础设施配置错误。
**影子 IT 检测**
- 识别在已批准的组织可见性和治理控制范围之外运营的基础设施。
**实时暴露可见性**
- 在执行期间增量流式传输安全发现,以提供即时的运营感知并加速安全响应工作流。
**项目结构**
```
easm-tool/
├── main.py # Central orchestrator
├── settings.py # Configuration management
├── subdomain_scanner.py # Subfinder-based subdomain enumeration
├── dns_resolver.py # DNS resolution and validation
├── http_prober.py # HTTP fingerprinting and technology detection
├── s3_scanner.py # Amazon S3 bucket exposure scanner
├── nuclei_scanner.py # Nuclei vulnerability scanner
├── .env # Environment variables (not committed)
├── .gitignore # Git ignore rules
└── README.md # Project documentation
```
### Python 依赖项
- `requests`
- `dnspython`
- `python-dotenv`
### 外部安全工具
| 工具 | 用途 | 来源 |
|---|---|---|
| Subfinder | 子域名枚举 | [projectdiscovery/subfinder](https://github.com/projectdiscovery/subfinder) |
| Nuclei | 漏洞扫描 | [projectdiscovery/nuclei](https://github.com/projectdiscovery/nuclei) |
## 安装说明
### 1. 克隆仓库
```
git clone https://github.com/IrondiUg/External_Attack_Surface_Management.git
cd External_Attack_Surface_Management
```
2. 在 WSL 上安装 Go
```
wget https://go.dev/dl/go1.22.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.bashrc
source ~/.bashrc
go version
```
3. 安装 Subfinder 和 Nuclei
```
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
nuclei -update-templates
```
4. 创建 Python 虚拟环境
```
python3 -m venv venv
source venv/bin/activate
```
5. 安装 Python 依赖项
```
pip install requests dnspython python-dotenv
```
### 配置
在项目根目录中创建一个 .env 文件:
```
TARGET_DOMAIN=yourdomain.com
COMPANY_NAME=yourcompany
```
- `TARGET_DOMAIN` - 目标组织的根域名
- `COMPANY_NAME` - 用于生成 S3 排列组合的组织名称
### 运行该工具
```
source venv/bin/activate
python main.py
```
### 输出示例
```
=======================================================
EASM Scan — example.com
=======================================================
=======================================================
Phase 1a: Subdomain Discovery
=======================================================
[Subfinder] Scanning example.com...
[Subfinder] Found 5 unique subdomains
--- Discovered Subdomains ---
[1] mail.example.com (source: alienvault)
[2] api.example.com (source: virustotal)
[3] dev.example.com (source: subfinder)
[4] staging.example.com (source: certspotter)
[5] vpn.example.com (source: subfinder)
=======================================================
Phase 1b: DNS Resolution
=======================================================
[1/5] [OK] mail.example.com -> 93.184.216.34
[2/5] [OK] api.example.com -> 93.184.216.35
[3/5] [FAIL] dev.example.com -> NXDOMAIN
[4/5] [OK] staging.example.com -> 93.184.216.36
[5/5] [FAIL] vpn.example.com -> TIMEOUT
=======================================================
Phase 1c: HTTP Enrichment
=======================================================
[1/3] mail.example.com -> 200 | Mail Login | Nginx
[2/3] api.example.com -> 403 | Forbidden | Apache, Cloudflare
[3/3] staging.example.com -> 200 | Staging Dashboard | Jenkins, React
=======================================================
Phase 1d: S3 Bucket Scanning
=======================================================
[S3] Generated 38 bucket name permutations
Checking [1/38]: example-dev ... not found
Checking [2/38]: example-backup ... FOUND (public)
Checking [3/38]: example-staging ... FOUND (private)
=======================================================
Phase 1 Results — Full Summary
=======================================================
--- Subdomains ---
Domain IP Status Title Tech
--------------------------------------------------------------------------
mail.example.com 93.184.216.34 200 Mail Login Nginx
api.example.com 93.184.216.35 403 Forbidden Apache
staging.example.com 93.184.216.36 200 Staging Dashboard Jenkins
dev.example.com - - - -
vpn.example.com - - - -
--- S3 Bucket Findings ---
Bucket Public Listing Severity Files Found
--------------------------------------------------------
example-backup YES YES CRITICAL 2 file(s)
-> production.env
-> db-dump-2024.sql
example-staging No No MEDIUM 0 file(s)
=======================================================
Phase 2: Vulnerability Scanning (Nuclei)
=======================================================
[Nuclei] Scanning LIVE subdomains (2 targets)...
[FINDING]
Name: Jenkins Unauthenticated Dashboard
Severity: HIGH
Host: staging.example.com
Matched URL: https://staging.example.com/dashboard
Description: Jenkins dashboard accessible without authentication
Tags: jenkins, exposure, misconfig
--------------------------------------------------
=======================================================
Scan Complete
=======================================================
Target: example.com
Subdomains found: 5
Live domains: 2
S3 buckets found: 2
Public buckets: 1
Nuclei findings: 1
- Critical: 0
- High: 1
- Medium: 0
=======================================================
```
## 法律声明
⚠️ **重要提示:此工具仅限于对您拥有或已获得明确书面测试许可的系统和域名使用。根据适用的法律(包括《计算机滥用法》和《计算机欺诈和滥用法》),对您不拥有的系统进行未经授权的扫描可能是违法的。作者对任何滥用此工具的行为概不负责。**
## 作者:Irondi Ugochukwu G
### **参考**
- Subfinder — https://github.com/projectdiscovery/subfinder
- Nuclei — https://github.com/projectdiscovery/nuclei
- dnspython — https://www.dnspython.org
- requests — https://docs.python-requests.org
- python-dotenv — https://pypi.org/project/python-dotenv
- AWS S3 文档 — https://docs.aws.amazon.com/s3
标签:AES-256, DNS情报, Docker部署, EASM, GitHub, HTTP指纹识别, S3暴露检测, Unix, 云配置错误, 外部攻击面管理, 子域名枚举, 实时处理, 密码管理, 影子IT发现, 攻击者视角, 攻击路径分析, 攻击面评估, 数字足迹, 数据展示, 日志审计, 暴露面收敛, 漏洞前期信息收集, 漏洞评估, 系统安全, 红队, 网络安全, 逆向工具, 隐私保护