天天看點

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

0x01 view source

flag放在源碼之中,但是網頁的腳本限制了滑鼠作用,無法點選和選中,直接F12或者浏覽器快捷鍵檢視網頁源碼即可得到flag

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag:cyberpeace{e07dcafaeeb31df23b4d661dd4da56f9}

0x02 get_post

GET和POST是http協定的兩種主要請求方式

GET請求直接把參數包含在url中

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

POST請求在網頁沒有輸入的情況下,利用工具送出,如hackerbar

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag:cyberpeace{c4e43c9c9d0f729358dd9417219a9da0}

0x03 robots

robots協定會在網站主目錄産生一個robots.txt檔案,打開檔案,看到flag所在位置,通路flag_is_h3re.php擷取flag

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag:cyberpeace{1b59446bc8e566382e01b0c209b899bd}

0x04 backup

備份檔案分三種

1.編輯器自動備份

2.版本控制系統備份

3.開發者主動備份

知道了首頁的備份檔案index.php.bak,通路得到檔案,删除bak字尾再用浏覽器打開php檔案得到flag

flag: cyberpeace{4376485b1a095581d7fb57b8ab3bb924}

0x05 cookie

使用浏覽器控制台找到cookie,按照其中資訊通路cookie.php,得到flag

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth
攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag: cyberpeace{0816ff94f7edddb54f92f5c9d826a1a0}

0x06 disabled_button

修改前端代碼,将按鈕的disable屬性去掉就可以點選了

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag: cyberpeace{de3c3c35166596311b23137ae6f3d33a}

0x07 simple_js

檢視網頁源代碼

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

将fromCharCode中的16進制轉為ascii字元, 55 , 56 , 54 , 79 , 115 , 69 , 114 , 116 , 107 , 49 , 50 55,56,54,79,115,69,114,116,107,49,50 55,56,54,79,115,69,114,116,107,49,50,但是輸入之後還是不對,再細看源碼,發現循環沒有用到tab,也就是說沒有用到輸入的資料,将源碼copy下,把其中的tab2改成tab,得到flag。

<html>
<head>
    <title>JS</title>
    <script type="text/javascript">
    function dechiffre(pass_enc){
        var pass = "70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65";
        var tab  = pass_enc.split(',');
                var tab2 = pass.split(',');var i,j,k,l=0,m,n,o,p = "";i = 0;j = tab.length;
                        k = j + (l) + (n=0);
                        n = tab2.length;
                        for(i = (o=0); i < (k = j = n); i++ ){
                        	o = tab[i-l];
                        	//tab2改為tab
                        	p += String.fromCharCode((o = tab[i]));
                            if(i == 5)break;
                            }
                        for(i = (o=0); i < (k = j = n); i++ ){
                        o = tab[i-l];
                                if(i > 5 && i < k-1)
                                		//tab2改為tab
                                        p += String.fromCharCode((o = tab[i]));
                        }
        p += String.fromCharCode(tab2[17]);
        pass = p;return pass;
    }
    //直接彈出答案
    var s = "\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30";

    //h = window.prompt('Enter password');
    alert( dechiffre(s) );
</script>
</head>

</html>
           

或者直接寫腳本将字元串中的十六進制轉為字元

flag:cyberpeace{786OsErtk12}

0x08 xff_referer

打開網頁後第一個要求是IP位址必須為123.123.123.123,根據http協定,其頭字段的X-Forwarded-For字段是用來判别最原始的來源ip,即用burpsuit抓取http請求包,在頭字段添加X-Forwarded-For字段就可以僞造來源ip

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

送出之後反回一個頁面,要求必須來自https//:www.google.com。

http請求頭中Referer字段便是用來告訴伺服器該網頁是從哪個頁面連結過來,即需要在請求頭中再加入一個Referer字段

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

送出得到flag

flag: cyberpeace{17bb357d42b6151576a75f2ef3089cdb}

0x09 webshell

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

網頁描述的是一個一句話木馬的webshell,根據題意,需要連接配接這個webshell

利用菜刀連接配接
攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

找到flag
攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag:cyberpeace{8333cbdfb5aa36d1238a005b1241a6cb}

0x0A command_execution

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

一個web程式,調用系統的ping指令,限制參數數量為3,題目描述之中書名這個程式沒有寫waf,沒有過濾參數,就可以考慮用linux管道執行指令尋找flag

& find / 列出系統中所有檔案

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

在網頁頁面中找到flag所在的目錄,用cat讀取檔案

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag: cyberpeace{25b31692838e8403383f9916e03e0705}

0x0B simple_php

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

根據網頁代碼,需要通過url接受兩個參數,代碼中的判斷條件比較有意思,第一個是要求參數a為0的同時又不能為0,第二個條件則是要求b不能為數字,但又得大于1234。

利用php變量的特性,可以利用數字後面添加字元滿足條件擷取flag。

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth

flag: Cyberpeace{647E37C7627CC3E4019EC69324F66C7C}

0x0C weak_auth

根據提示,利用admin登入,burpsuit暴力破解,得到密碼登入。

攻防世界-web writeup(xctf)0x01 view source0x02 get_post0x03 robots0x04 backup0x05 cookie0x06 disabled_button0x07 simple_js0x08 xff_referer0x09 webshell0x0A command_execution0x0B simple_php0x0C weak_auth