You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pentesting-web/cache-deception/README.md
+88Lines changed: 88 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,6 +294,89 @@ Note that the **cache proxy** should be **configured** to **cache** files **base
294
294
295
295
Learn here about how to perform[ Cache Deceptions attacks abusing HTTP Request Smuggling](../http-request-smuggling/index.html#using-http-request-smuggling-to-perform-web-cache-deception).
This pattern combines a Client-Side Path Traversal (CSPT) primitive in a Single-Page App (SPA) with extension-based CDN caching to publicly cache sensitive JSON that was originally only available via an authenticated API call.
300
+
301
+
High level idea:
302
+
303
+
- A sensitive API endpoint requires a custom auth header and is correctly marked as non-cacheable by origin.
304
+
- Appending a static-looking suffix (for example, .css) makes the CDN treat the path as a static asset and cache the response, often without varying on sensitive headers.
305
+
- The SPA contains CSPT: it concatenates a user-controlled path segment into the API URL while attaching the victim’s auth header (for example, X-Auth-Token). By injecting ../.. traversal, the authenticated fetch is redirected to the cacheable path variant (…/v1/token.css), causing the CDN to cache the victim’s token JSON under a public key.
306
+
- Anyone can then GET that same cache key without authentication and retrieve the victim’s token.
4. The CDN treats .css as a static asset and caches the JSON with Cache-Control: public, max-age=...
364
+
5. Public retrieval: anyone can then GET https://api.example.com/v1/token.css and obtain the cached token JSON.
365
+
366
+
Preconditions
367
+
368
+
- SPA performs authenticated fetch/XHR to the same API origin (or cross-origin with working CORS) and attaches sensitive headers or bearer tokens.
369
+
- Edge/CDN applies extension-based caching for static-looking paths (e.g., *.css, *.js, images) and does not vary the cache key on the sensitive header.
370
+
- Origin for the base endpoint is non-cacheable (correct), but the extension-suffixed variant is allowed or not blocked by edge rules.
371
+
372
+
Validation checklist
373
+
374
+
- Identify sensitive dynamic endpoints and try suffixes like .css, .js, .jpg, .json. Look for Cache-Control: public/max-age and X-Cache: Hit (or equivalent, e.g., CF-Cache-Status) while content remains JSON.
375
+
- Locate client code that concatenates user-controlled input into API paths while attaching auth headers. Inject ../ sequences to redirect the authenticated request to your target endpoint.
376
+
- Confirm the authenticated header is present on the retargeted request (e.g., in a proxy or via server-side logs) and that the CDN caches the response under the traversed path.
377
+
- From a fresh context (no auth), request the same path and confirm the secret JSON is served from cache.
378
+
379
+
297
380
## Automatic Tools
298
381
299
382
-[**toxicache**](https://github.com/xhzeem/toxicache): Golang scanner to find web cache poisoning vulnerabilities in a list of URLs and test multiple injection techniques.
@@ -309,6 +392,11 @@ Learn here about how to perform[ Cache Deceptions attacks abusing HTTP Request S
309
392
-[How I found a 0-Click Account takeover in a public BBP and leveraged it to access Admin-Level functionalities](https://hesar101.github.io/posts/How-I-found-a-0-Click-Account-takeover-in-a-public-BBP-and-leveraged-It-to-access-Admin-Level-functionalities/)
310
393
-[Burp Proxy Match & Replace](https://portswigger.net/burp/documentation/desktop/tools/proxy/match-and-replace)
311
394
-[watchTowr Labs – Sitecore XP cache poisoning → RCE](https://labs.watchtowr.com/cache-me-if-you-can-sitecore-experience-platform-cache-poisoning-to-rce/)
395
+
-[Cache Deception + CSPT: Turning Non Impactful Findings into Account Takeover](https://zere.es/posts/cache-deception-cspt-account-takeover/)
396
+
-[CSPT overview by Matan Berson](https://matanber.com/blog/cspt-levels/)
397
+
-[CSPT presentation by Maxence Schmitt](https://www.youtube.com/watch?v=O1ZN_OCfNzg)
398
+
-[PortSwigger: Web Cache Deception](https://portswigger.net/web-security/web-cache-deception)
Copy file name to clipboardExpand all lines: src/pentesting-web/client-side-path-traversal.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,29 @@ A client side path traversal occurs when you can **manipulate the path of a URL*
13
13
- Check this [**CSPT playground**](https://github.com/doyensec/CSPTPlayground) to try the technique.
14
14
- Check [**this tutorial**](https://blog.doyensec.com/2024/12/03/cspt-with-eval-villain.html) on how to use the browser extension in the playground.
15
15
16
+
## CSPT-assisted web cache poisoning/deception
17
+
18
+
CSPT can be chained with extension-based CDN caching to exfiltrate sensitive JSON leaked by authenticated API calls:
19
+
20
+
- A frontend concatenates user-controlled input into an API path and attaches authentication headers in fetch/XHR.
21
+
- By injecting dot-segments (../) you can retarget the authenticated request to a different endpoint on the same origin.
22
+
- If that endpoint (or a path variant with a static-looking suffix like .css) is cached by the CDN without varying on auth headers, the victim’s authenticated response can be stored under a public cache key and retrieved by anyone.
23
+
24
+
Quick recipe:
25
+
26
+
1) Find SPA code building API URLs from path parameters while sending auth headers.
27
+
2) Identify sensitive endpoints and test static suffixes (.css, .js, .jpg, .json) to see if the CDN flips to Cache-Control: public/max-age and X-Cache: Hit while returning JSON.
28
+
3) Lure the victim to a URL that injects traversal into the SPA parameter so the authenticated fetch hits the cacheable path variant (for example, ../../../v1/token.css).
29
+
4) Read back the same URL anonymously to obtain the cached secret (token → ATO).
30
+
31
+
See details and mitigations in the Cache Deception page: [Cache Poisoning and Cache Deception](cache-deception/).
32
+
33
+
## References
34
+
35
+
-[Cache Deception + CSPT: Turning Non Impactful Findings into Account Takeover](https://zere.es/posts/cache-deception-cspt-account-takeover/)
36
+
-[CSPT overview by Matan Berson](https://matanber.com/blog/cspt-levels/)
37
+
-[PortSwigger: Web Cache Deception](https://portswigger.net/web-security/web-cache-deception)
0 commit comments