WAF (Web application firewall) is becoming one of the standard security solutions. Because of it, many companies don't even care about vulnerabilities in Web applications. Unfortunately, not all WAF are non-circumvention! This article will tell you how to use the injection artifact Sqlmap to bypass Wafs/idss.
SVN download the latest version of Sqlmap
SVN checkout Https://svn.sqlmap.org/sqlmap/trunk/sqlmap Sqlmap-dev
Our focus is on using the tamper script to modify the request to evade the WAF's rule detection. Many times, you need to use multiple tamper scripts together.
For all tamper scripts please refer to: https://svn.sqlmap.org/sqlmap/trunk/sqlmap/tamper/
Here, we take the example of space2hash.py and space2morehash.py for MySQL. Both scripts will automatically convert all spaces to random comments, and the extended version of this script (space2morehash.py) will also help you to "disrupt" the method function to bypass the WAF detection.
Example: * Input:1 and 9227=9227
* output:1%23pttmjopxdwj%0aand%23cwfcvrpv%0a9227=9227
Well, let's talk about the point.
You can use the command –tamper to invoke the script as follows:
./sqlmap.py-u http://127.0.0.1/test.php?id=1-v 3–dbms "MySQL" –technique u-p id–batch–tamper "space2morehash.py"
As we can see, the space in the request is replaced with the URL-encoded %23randomtext%0a
and CHAR(), USER (),CONCAT ( ) This function is replaced with function%23randomtext%0a ()
There are also two spaces to replace the script: space2mssqlblank.py and space2mysqlblank.py, as
charencode.py andchardoubleencode.py is a two-tamper script used to disrupt coding, which is useful when bypassing different keyword filters.
If web apps are developed using Asp/asp.net, charunicodeencode.py and percentage.py can help you evade the detection of WAF.
Interestingly, ASP allows to use multiple% number intervals between characters, such as and 1=%%%%%%%%1 are legal!
Summarize:
Here are a few of the representative tamper scripts to help us get around the WAF, each with its own usage scenario, or it needs to be used flexibly.
Reference article: "Cookie injection using Sqlmap", bypassing WAF interception via HTTP parameter contamination
How to use Sqlmap to bypass WAF