githubEdit

WAF (Web Application Firewall) Detection

WAF (Web Application Firewall) is a specific form of application firewall that filters, monitors, and blocks HTTP traffic to and from a web service.

Automation

nmap --script=http-waf-fingerprint example.com

wafw00f https://example.com

WAF Bypasses

Encoding Evasion: Use URL, Unicode, Base64, or other encodings to disguise payloads.

HTTP Parameter Pollution: Manipulate parameters to exploit the way the WAF processes multi-instance parameters. (One of my favourite techniques!)

Session Splicing: Divide the attack into multiple requests or sessions to disrupt the WAF's ability to correlate the events.

Verb Tampering: Change the HTTP method (GET, POST, HEAD, etc.) to an unconventional one that the WAF might not inspect.

Path Obfuscation: Include irrelevant path information that gets ignored by the server but confuses the WAF (like using directory traversal techniques).

Query String Manipulation: Alter the query string with special characters or payloads that might be overlooked by the WAF.

Header Manipulation: Modify HTTP headers such as User-Agent, Referer, or custom headers in ways that are not expected.

Cookie Poisoning: Inject payloads into cookie values which may not be inspected or properly sanitized by the WAF.

Content-Type Evasion: Use unusual or mismatched content-types in the HTTP header to bypass checks that are content-type specific.

Extension Manipulation: Changing file extensions or using obscure ones to evade filters that inspect file names.

Protocol-Level Evasion: Utilize discrepancies in protocol implementations (like ambiguous requests) that may be differently interpreted by the WAF and the target web server.

Attack Obfuscation with Legitimate Requests: Mix in legitimate traffic with the attack traffic to reduce the anomaly score that might otherwise trigger the WAF.

Bypassing with JavaScript: Use JavaScript to construct the final payload in the client-side browser, which may not be executed or recognized by the WAF.

Using Comment Injection: Place comments within SQL statements or scripts to disrupt signature detection.

Utilizing Server-Side Request Forgery (SSRF): Exploit the server's functionality to make requests that bypass the WAF's rules.

Timing Attacks: Execute actions with delays, leveraging the fact that some WAFs have a time window for rule execution.

Ruleset Flaws: Exploit known weaknesses in the rulesets employed by popular WAFs, which are sometimes documented by security researchers.

bash usage example:

References:

  • https://github.com/vincentcox/bypass-firewalls-by-DNS-history

  • https://github.com/RedSection/pFuzz

  • https://github.com/nemesida-waf/waf-bypass

  • Domain IP history: https://viewdns.info/iphistory/

  • Bypasses and info:

    • https://github.com/0xInfection/Awesome-WAF

    • https://github.com/waf-bypass-maker/waf-community-bypasses


Manual identification

Always check DNS History for original IP leak:

  • https://whoisrequest.com/history/


WAF detection


Good bypass payload examples

Try accessing alternate hostnames or paths that may reveal origin servers:

  • dev.domain.com

  • stage.domain.com

  • ww1/ww2/ww3...domain.com

  • www.domain.uk/jp/


Akamai

Target origin hostnames:

  • origin.sub.domain.com

  • origin-sub.domain.com

Send header:

Payload examples:


ModSecurity Bypass


Cloudflare

Cloudflare enumeration:

  • https://github.com/mandatoryprogrammer/cloudflare_enum

    • Example: cloudflare_enum.py disney.com

  • https://viewdns.info/iphistory/?domain=domain.com

  • https://whoisrequest.com/history/

Cloudflare bypass payload examples:


Aqtronix WebKnight WAF

SQLi examples:

XSS examples:


ModSecurity (more payloads)

XSS:

SQLi:


Imperva Incapsula

Reference: https://medium.com/@0xpegg/imperva-waf-bypass-96360189c3c5

Example payloads (URL-encoded/complex XSS):

Parameter pollution / SQLi examples:

XSS (encoded payload example):


FAIL2BAN SQLi


F5 BigIP

RCE example:

Read file example:

XSS examples:

JS-F**k style payload examples (obfuscated):

Encoded onwheel example:


More payloads and collections

  • https://github.com/Walidhossain010/WAF-bypass-xss-payloads


Wordfence


RCE WAF globbing bypass


Additional payload examples (Cloudflare/ModSecurity/others)


Images


Last updated: 2 years ago

Last updated