Web Cache Deception

Web cache deception works by sending the victim a URL which will cache the response for everyone to see.
Only possible due to path confusion, sometimes the caching server is configured to cache any page ending with a specific extension (css, JPG, PNG, ect):
-> Cache all static pages no matter what the response headers say.
EX: âexample.com/nonexistent.cssâ, The caching server would cache this response regardless of what the response headers say.
Exploitation
Find a page exposing sensitive information.
Check for path confusion.
See if the response is cached.
See if the cached response is public.
To test for web cache deception, try one of the several path-confusing payloads
example.com/nonexistent.css
example.com/%0Anonexistent.css
example.com/%3Bnonexistent.css
example.com/%23nonexistent.css
example.com/%3fname=valnonexistent.css
Path confusion
All about the web server interpreting a request one way while the caching server interprets it a different way.
occurs when an application loads the same resources no matter what the path is.

As we can see above, any path after â/â will essentially be passed to the same function giving the same results.
EX: both the âexample.comâ and âexample.com/something'' URLs would be sent to the same catch_all function.
Techniques cause path confusion
Path parameter
When additional paths are added to the request passed to the same backend function.
Server sees: example.com/account.php/
The caching server sees: example.com/account.php/nonexistent.css
Encoded newline (\n)
Some proxies and web servers stop reading after the new line character but the caching server does not.
The server sees: example.com/account.php
The caching server sees: example.com/account.php%0Anonexistent.css
Encoded semicolon (;)
Some web servers treat semicolons(;) as parameters, and the caching server may treat the request as a separate resource.
The server sees: âexample.com/account.phpâ with the parameter ânonexistent.cssâ
The caching server sees: âexample.com/account.php%3Bnonexistent.cssâ
Encoded pound (#)
Web servers often process the pound character as an HTML fragment identifier and stop parsing the URL after that, the caching server may not recognize this.
The server sees: âexample.com/account.php
Caching server sees: âexample.com/account.php%23nonexistent.cssâ
Encoded question mark (?)
Web servers treat question marks(?) as parameters but the caching server treats the response differently.
The server sees: âexample.com/account.phpâ
The Caching server sees: âexample.com/account.php%3fname=valnonexistent.cssâ
Last updated