Quick answer: A WAF (Web Application Firewall) filters requests looking for malicious patterns. A "bypass" consists of rewriting your payload so it doesn't match those signatures without losing its effect: encoding it, toggling case, inserting comments, splitting it with HPP or using alternative syntax. It's only done on authorized targets and to demonstrate that the underlying vulnerability exists despite the filter.
What is a WAF and why can it be evaded?
A WAF is a layer that inspects HTTP traffic and blocks what looks like an attack, comparing it against signatures and rules (for example, "if you see <script> or UNION SELECT, block"). It's a useful defense, but it has a fundamental weakness: it filters by patterns, it doesn't understand intent. If you can express the same payload in a form the rule doesn't recognize but the browser or the database does interpret, you get through.
Important so you don't fool yourself: a WAF bypass isn't itself a vulnerability. It's the demonstration that a real vulnerability (XSS, SQLi…) is still exploitable despite the filter. Without a flaw behind it, evading the WAF is worthless. What you report is the flaw; the bypass is the proof that the WAF doesn't mitigate it.
Ethics first: all of this is practiced in your own labs or in programs whose scope allows it. Evading a system's defenses without authorization is illegal. Here the goal is to understand the technique to report and to build better defenses.
What types of WAF exist?
Before evading, it's worth knowing which category you're facing, because each one has different blind spots:
- Network / signature-based WAFs. They inspect traffic looking for known patterns (ModSecurity with the core rule set is the classic open source example). They're the most evadable with transformations, because they reason by string matching.
- Cloud WAFs (CDN). They sit in front of the application as a service (the big CDNs offer this layer). On top of signature filtering they usually add rate limiting, IP reputation and captcha-type challenges. Harder, but not infallible.
- Application-based / RASP WAFs. They integrate inside the app itself and understand the request context better. The hardest to evade because they don't reason only by patterns.
The common key: all of them, to a greater or lesser degree, decide with incomplete information. The more a WAF relies on rigid signatures, the more room you have to rewrite the payload without it recognizing it.
How to fingerprint a WAF?
Before evading, identify what you're facing. Each WAF has recognizable tells:
- A characteristic block page or code. Send an obviously malicious payload (
?q=<script>alert(1)</script>) and observe: a 403, a 406, an "Access Denied", a challenge page? The format gives away the product.
- Headers and cookies. Some WAFs inject their own headers or cookies into the response.
- Tools.
wafw00f is the classic for fingerprinting the product; sqlmap has --identify-waf. They give you a hint of the vendor, and each vendor has documented bypasses.
Knowing which WAF is in front saves you hours: you aim the techniques at its known blind spots instead of testing blindly.
Bypass techniques (with XSS and SQLi)
There's no silver bullet: you combine and iterate. These are the families that work most.
1. Encoding and double encoding
Many rules look for the literal string. Encode it and maybe the rule won't see it, but the server decodes it before using it:
Original: <script>
URL enc: %3Cscript%3E
Double enc: %253Cscript%253E
HTML enc: <script> (depending on context)
For SQLi, URL-encoding key characters or using hex encoding of strings is a common resource.
2. Case toggling
If the signature looks for union select in lowercase and the SQL engine is case-insensitive, toggle it:
UnIoN SeLeCt password FROM users
Same with XSS: <ScRiPt> can bypass a rule that only looks at <script> in lowercase.
3. Inline comments
In SQL, MySQL's inline comments split keywords the WAF looks for whole, without breaking the query:
UNI/**/ON SEL/**/ECT
1/**/OR/**/1=1
In XSS, inserting characters the browser tolerates inside the tag can break the signature without breaking execution.
4. Alternative payloads and syntax
The most robust way: don't use the textbook payload. For XSS, if <script> is blocked, there are dozens of vectors with other tags and event handlers:
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
<body onpageshow=alert(1)>
For SQLi, if OR 1=1 is filtered, there are logical equivalents and alternative functions that achieve the same effect. Understanding the vulnerability from the inside (in the Academy) is what lets you improvise vectors instead of depending on a list.
5. HTTP Parameter Pollution (HPP)
Sending the same parameter several times can confuse the WAF and the back-end about which to process. If the WAF inspects the first occurrence and the server concatenates or takes the last, you can split the payload across several appearances of the parameter and sneak each half separately.
6. Chunked / manipulating the body
Fragmenting the body with Transfer-Encoding: chunked, playing with spaces, line breaks or the Content-Type can prevent the WAF from reconstructing the payload the way the back-end sees it. It's terrain that connects with desync techniques like request smuggling.
7. Alternative whitespace and normalization
Many signatures expect a literal space between tokens (UNION SELECT). SQL accepts other separators the WAF may not account for: tabs, line breaks, comments (/**/), or control characters. In SQL, parentheses also work to do without spaces:
UNION(SELECT(password)FROM(users))
Another route is unicode normalization: if the back-end normalizes certain unicode characters to their ASCII equivalent after the WAF has inspected, a "weird" character passes the filter and then turns into the dangerous one. Same with overlong encodings or the mishandling of null bytes in some stacks. The underlying idea repeats: exploit any difference between what the WAF sees and what the application interprets.
The method: iterating against the filter
Evading a WAF is an empirical process:
- Confirm the vulnerability without the WAF in the way if you can (or with a minimal payload).
- Fingerprint the WAF.
- Send the standard payload and observe exactly what it blocks (the keyword? a character? the length?).
- Isolate the trigger and transform it with a technique from above.
- Iterate, combining techniques, until the payload passes and still works.
- Document the minimal payload that evades the filter and demonstrate the real impact.
Tools like Burp Intruder (to automate variations) and sqlmap's tamper scripts (for automated SQLi, see the sqlmap tutorial) speed up step 5, but the judgment of what to test is yours.
Automating the bypass search
Testing dozens of transformations by hand is tedious, so you automate it sensibly. In Burp Intruder you can load a list of variants of the same payload (case, comments, encoding, alternative syntax) and fire them at the parameter, watching which responses don't trigger the WAF block. The length and status-code columns tell you at a glance which ones passed.
For SQLi, sqlmap's tamper scripts chain these transformations automatically (--tamper=space2comment,randomcase,between), and --identify-waf guides which combination to try. For XSS, payload collections like those in PayloadsAllTheThings give you hundreds of vectors ready to iterate.
Important warning: automating bypass generates a lot of noise and can trigger rate limiting or IP bans. Control the speed, rotate if the program allows it and don't turn the search into a brute-force attack that degrades the service. Automation speeds things up, but the goal is still to understand why a specific variant evades the filter, not to fire thousands blindly.
Why this matters for your report
A flaw that the WAF blocks with the textbook payload but that you demonstrate exploitable with a bypass is worth far more in a report: you prove the mitigation is insufficient and the real risk persists. Security teams value it because it points out that their defense gives a false sense of security.
And on the other side: understanding bypasses also teaches you to defend. A WAF is a layer, not a solution; the real fix is fixing the vulnerability in the code, not trusting the filter.
Frequently asked questions (FAQ)
Is evading a WAF illegal?
It depends on the target. In your labs or in a bug bounty program whose scope allows it, it's a legitimate technique to demonstrate that a vulnerability is still exploitable. Against a system without authorization, it's illegal.
Does a WAF bypass count as a reportable vulnerability?
On its own, usually not. What's reportable is the underlying vulnerability (XSS, SQLi…); the bypass is the proof the WAF doesn't mitigate it. A flaw exploitable despite the WAF is worth more because it shows the defense gives false security.
Is there a universal payload that evades any WAF?
No. Each WAF and each configuration is different. Evading is an empirical process of fingerprinting, observing what it blocks and iterating by combining techniques. Anyone selling you a "magic bypass" is selling you hot air.
How does an app really defend against these bypasses?
By fixing the vulnerability in the code: parameterized queries against SQLi, contextual output encoding against XSS, strict validation. The WAF is a temporary mitigation layer, never the underlying solution.
How to train it
Bypasses aren't memorized from a list: they're trained by understanding the vulnerability underneath. When you know why an <img onerror> executes or why an inline comment doesn't break a SQL query, generating variants is natural. Study the theory of XSS and SQLi, practice in labs that replicate real reports and follow an ordered path. The WAF bypass is proof that you master the vulnerability, not an isolated trick.