Zeeshanafridai/CORScanner

GitHub: Zeeshanafridai/CORScanner

一款自动化 CORS 错误配置扫描器,集成 PoC 利用生成与漏洞赏金报告输出,帮助安全研究人员高效发现并验证跨域漏洞。

Stars: 1 | Forks: 0

# CORS Exploiter 检测所有主要的 CORS 绕过技术,生成可直接提交的 PoC HTML 利用文件,并生成适用于 bug bounty 的 Markdown 报告。 ## 功能 - 每个URL测试 **10+ 种绕过技术** - **PoC 生成器** — 即插即用的 HTML 利用代码,支持数据外带 - **多 URL 扫描** — 支持并行处理和文件输入 - **Endpoint 发现** — 自动探测 20+ 个常见 API 路径 - **报告生成器** — 生成适用于 HackerOne/Bugcrowd 的 Markdown + JSON - **零依赖** — 纯 Python 标准库(无需 pip install) ## 安装 ``` git clone https://github.com/yourhandle/cors-exploiter cd CORScanner python3 cors_exploit.py --help ``` 无需 pip install。纯 Python 3.6+ 实现。 ## 用法 ### 基础扫描 ``` python3 cors_exploit.py -u https://target.com/api/user ``` ### 认证扫描(使用 session cookie) ``` python3 cors_exploit.py -u https://target.com/api/me -c "session=abc123; auth=xyz" ``` ### 扫描 + 自动发现 endpoint + 生成 PoC ``` python3 cors_exploit.py -u https://target.com -c "session=abc123" --discover --poc --poc-dir ./my_pocs ``` ### 自定义攻击者域名 ``` python3 cors_exploit.py -u https://target.com/api/user -a "my-evil-server.com" ``` ### 自定义 PoC 中的 exfil URL ``` python3 cors_exploit.py -u https://target.com/api/user --poc --exfil "https://your.burpcollaborator.net" ``` ### 从文件扫描多个 URL ``` python3 cors_exploit.py -f endpoints.txt -c "session=abc123" --threads 10 ``` ### 完整工作流:扫描 + PoC + 报告 ``` python3 cors_exploit.py -u https://target.com \ -c "session=abc123" \ --discover \ --poc --exfil "https://burpcollaborator.net/cors" \ --report \ -o findings.json ``` ## 测试的绕过技术 | # | 技术 | 发送的 Origin | 原理 | |---|-----------|-------------|--------------| | 1 | 任意 Origin 反射 | `https://evil.com` | 服务器反射任何 origin | | 2 | Null Origin | `null` | 接受来自沙盒 iframe 的请求 | | 3 | 前缀匹配 | `https://target.com.evil.com` | 薄弱的 `endsWith` 检查 | | 4 | 后缀匹配 | `https://eviltarget.com` | 薄弱的 `startsWith` 检查 | | 5 | 子域名通配符 | `https://sub.target.com` | `*.target.com` — 需要子域名接管 | | 6 | HTTP 降级 | `http://target.com` | 未验证协议 | | 7 | 受信任的子域名 | `https://dev.target.com` | 接受开发/测试/预发环境 | | 8 | 特殊字符 | `https://target.com%60.evil.com` | 解析器混淆 | | 9 | 端口变体 | `https://target.com:8080` | 未验证端口 | | 10 | 大写主机名 | `https://TARGET.COM` | 不区分大小写的匹配 | ## PoC 利用类型 ### 标准 XHR(最常见) ``` ``` ### Null Origin(沙盒 iframe) ``` ``` ## 真实的 Bug Bounty 流程 ``` 1. Find JWT/session cookie in browser 2. Run: python3 cors_exploit.py -u TARGET/api/me -c "SESSION_COOKIE" --discover 3. For each VULN finding: python3 cors_exploit.py -u VULN_URL --poc --exfil COLLAB_URL 4. Host PoC: python3 -m http.server 8080 --directory ./pocs 5. Generate report: --report 6. Submit to H1/Bugcrowd ``` ## 示例报告输出 ``` ## Finding #1 — Critical — Reflected | Field | Value | |-------|-------| | URL | https://target.com/api/user | | Severity | Critical | | ACAO Response | https://evil.com | | ACAC Response | true | ``` ## 许可证 MIT — 仅用于授权测试。
标签:CISA项目, Python, Web安全, 无后门, 蓝队分析