BYPASSING WEBAPP PROTECTIONS
ANTI-CSRF TOKEN BYPASS
anti-cross-site request forgery tokens in all HTTP requests is one of the first line of defense against the usage of automation tools. anti-csrf was originally introduced in the prevention of scenarios with malicious links. this security feature also inadvertently hardened the applications against the (unwanted) automation.
UNIQUE VALUE BYPASS
this mechanism is similar to the anti-CSRF technique except that there is no need to parse the web page content. by simply ensuring that each request has a unique value for a predefined parameter, the web application can easily prevent CSRF attempts while at the same time averting some of the automation tools.
CALCULATED PARAMETER BYPASS
this is a mechanism where a web application expects a proper parameter value to be calculated based on some other parameter value(s). Most often, one parameter value has to contain the message digest (e.g. h=MD5(id)
) of another one.
IP ADDRESS CONCEALING
this method is for when the target has a protection mechanism that blacklists any IP address that triggers a malicious event.
WAF BYPASS
sqlmap initially sends a predefined malicious looking payload using a non-existent parameter name such as ?pfov=... to test for the existence of a Web Application Firewall (WAF). to identify the actual protection mechanism, SQLMap uses a third-party library identYwaf, containing the signatures of 80 different WAF solutions.
USER-AGENT BLACKLISTING BYPASS
when an HTTP error code 5XX is ever encountered while running SQLMap, one of the first things to think of is the potential blacklisting of the default user-agent used by SQLMap
* e.g. User-agent: sqlmap/1.4.9 (http://sqlmap.org)
TAMPER SCRIPTS
the most popular mechanisms implemented by SQLMap for bypassing WAF/IPS solutions are the "tamper" scripts. these are a special kind of (Python) scripts written for modifying requests just before being sent to the target to bypass some protections.
one of the most popular tamper scripts between replaces all occurrences of greater than operator (>
) with NOT BETWEEN 0 AND #
, and the equals operator (=
) with BETWEEN # AND #
. This way, many primitive protection mechanisms (focused mostly on preventing XSS attacks) are easily bypassed, at least for SQLi purposes.
Tamper scripts can be chained, one after another, within the --tamper
option (e.g. --tamper=between,randomcase
), where they are run based on their predefined priority. A priority is predefined to prevent any unwanted behavior, as some scripts modify payloads by modifying their SQL syntax (e.g. ifnull2ifisnull). In contrast, some tamper scripts do not care about the inner content (e.g. appendnullbyte).
Tamper scripts can modify any part of the request, although the majority change the payload content
MISC BYPASSES
CHUNKED TRANSFER ENCODING
the Chunked
transfer encoding, turned on, splits the POST request's body into so-called "chunks." Blacklisted SQL keywords are split between chunks in a way that the request containing them can pass unnoticed.
HTTP PARAMETER POLLUTION (HPP)
this is where payloads are split in a similar way as in case of --chunked
between different same parameter named values (e.g..id=1&id=UNION&id=SELECT&id=username,password&id=FROM&id=users...
), which are concatenated by the target platform if supporting it (e.g. ASP
).
Last updated