Web cache poisoning
https://portswigger.net/web-security/web-cache-poisoning
Lab: Web cache poisoning with an unkeyed header
This lab is vulnerable to web cache poisoning because it handles input from an unkeyed header in an unsafe way. A user visits the home page roughly once every minute. To solve this lab, poison the cache with a response that executes alert(document.cookie) in the visitor's browser.
If we repeat the request, we can see this in response header:
30 seconds to reset cache.
Exploit Server ->
Solution:
If we visit the page with another browser, the script will be executed. The cache expires every 30 seconds.
Lab: Web cache poisoning with an unkeyed cookie
This lab is vulnerable to web cache poisoning because cookies aren't included in the cache key. A user visits the home page roughly once a minute. To solve this lab, poison the cache with a response that executes alert(1) in the visitor's browser.
Solution:
Lab: Web cache poisoning with multiple headers
This lab contains a web cache poisoning vulnerability that is only exploitable when you use multiple headers to craft a malicious request. A user visits the home page roughly once a minute. To solve this lab, poison the cache with a response that executes alert(document.cookie) in the visitor's browser.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
Exploit Server ->
Solution:
Lab: Targeted web cache poisoning using an unknown header
This lab is vulnerable to web cache poisoning. A user visits the home page roughly once a minute. The user also views any comments you post. To solve this lab, you need to poison the cache with a response that executes alert(document.cookie) in the visitor's browser. However, you also need to make sure that the response is served to the specific subset of users to which the intended victim belongs.
Burp Extension -> Param Miner
GET / HTTP/1.1 -> Extensions -> Param Miner -> Guess params -> Guess headers
Issue Activity -> Web cache poisoning -> X-Host header
Exploit Server ->
This way is not working. "Vary: User Agent" is the key. We need to identify user's User Agent.
Exploit Server -> Access Log
"GET /foo HTTP/1.1" 404 "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
Solution:
Lab: Web cache poisoning to exploit a DOM vulnerability via a cache with strict cacheability criteria
This lab contains a DOM-based vulnerability that can be exploited as part of a web cache poisoning attack. A user visits the home page roughly once a minute. Note that the cache used by this lab has stricter criteria for deciding which responses are cacheable, so you will need to study the cache behavior closely.
To solve the lab, poison the cache with a response that executes alert(document.cookie) in the visitor's browser.
GET / HTTP/1.1 -> Burp Extension -> Param Miner -> Guess params -> Guess headers
Issue Activity -> Web cache poisoning -> X-Forwarded-Host header
Exploit Server -> Access Log
"GET /resources/json/geolocate.json HTTP/1.1" 404
Exploit Server ->
Solution:
Lab: Combining web cache poisoning vulnerabilities
This lab is susceptible to web cache poisoning, but only if you construct a complex exploit chain.
A user visits the home page roughly once a minute and their language is set to English. To solve this lab, poison the cache with a response that executes alert(document.cookie) in the visitor's browser.
GET / HTTP/1.1 -> Burp Extension -> Param Miner -> Guess params -> Guess headers
Issue Activity -> Web cache poisoning -> X-Forwarded-Host and X-Original-URL headers
Exploit Server -> Access Log
"GET /resources/json/translations.json HTTP/1.1" 404
If we choose the language, the value will add lang cookie.
Cookie: session=gImZNUEhoU9aIQQRhG0K4MF5sdgbcK33; lang=es
Exploit Server ->
Solution chain:
Lab: Web cache poisoning via an unkeyed query string
This lab is vulnerable to web cache poisoning because the query string is unkeyed. A user regularly visits this site's home page using Chrome.
To solve the lab, poison the home page with a response that executes alert(1) in the victim's browser.
GET /?cb=1234 HTTP/1.1
- Not working.
GET / HTTP/1.1 -> Burp Extension -> Param Miner -> Guess params -> Guess headers
Issue Activity -> Web cache poisoning -> Origin header
Solution:
Lab: Web cache poisoning via an unkeyed query parameter
This lab is vulnerable to web cache poisoning because it excludes a certain parameter from the cache key. A user regularly visits this site's home page using Chrome.
To solve the lab, poison the cache with a response that executes alert(1) in the victim's browser.
GET / HTTP/1.1 -> Burp Extension -> Param Miner -> Guess params -> Guess everything!
Issue Activity -> Web cache poisoning -> Origin header, utm_content query parameter
Solution:
Lab: Parameter cloaking
This lab is vulnerable to web cache poisoning because it excludes a certain parameter from the cache key. There is also inconsistent parameter parsing between the cache and the back-end. A user regularly visits this site's home page using Chrome.
To solve the lab, use the parameter cloaking technique to poison the cache with a response that executes alert(1) in the victim's browser.
Manual testing: utm_content parameter enabled but not effect caching
Solution:
Lab: Web cache poisoning via a fat GET request
This lab is vulnerable to web cache poisoning. It accepts GET requests that have a body, but does not include the body in the cache key. A user regularly visits this site's home page using Chrome.
To solve the lab, poison the cache with a response that executes alert(1) in the victim's browser.
Solution:
Lab: URL normalization
This lab contains an XSS vulnerability that is not directly exploitable due to browser URL-encoding.
To solve the lab, take advantage of the cache's normalization process to exploit this vulnerability. Find the XSS vulnerability and inject a payload that will execute alert(1) in the victim's browser. Then, deliver the malicious URL to the victim.
Solution:
Lab: Cache key injection
This lab contains multiple independent vulnerabilities, including cache key injection. A user regularly visits this site's home page using Chrome.
To solve the lab, combine the vulnerabilities to execute alert(1) in the victim's browser. Note that you will need to make use of the Pragma: x-get-cache-key header in order to solve this lab.
Solution:
Lab: Internal cache poisoning
This lab is vulnerable to web cache poisoning. It uses multiple layers of caching. A user regularly visits this site's home page using Chrome.
To solve the lab, poison the internal cache so that the home page executes alert(document.cookie) in the victim's browser.
Send it constantly, because, timing is the key. We should see exploit server url in the response 3 times.
Exploit Server ->
Last updated