2021 CakeCTF - Writeup
題目:nostrings
, Hash-browns
, rflag
, ALDRYA
Score:NCtfU - 5th
nostrings
Challenge Info
CTF / rev / warmup –> strings
nostrings
Solution
用假 flag 組成真 flag 的題目:
|
|
Flag
CakeCTF{th3_b357_p14c3_70_hid3_4_f14g_i5_in_4_f14g_f0r357}
Hash-browns
Challenge Info
Would you mind making the finest hash browns, chef?
hash_browns
Solution
程式流程簡單來說:
- 每次取輸入的 2 bytes 分別計算 md5, sha256
- 要跟特定的 hash 一樣
把 hash 動態抓出來爆破就可以了:
|
|
Flag
CakeCTF{(^o^)==(-p-)~~(=_=)~~~POTATOOOO~~~(^@^)++(-_-)**(^o-)_486512778b4}
rflag
Challenge Info
CTFer is good at guessing something, right?
rflag
, flag.txt
Solution
RUST 題,目標是猜中一個隨機字串 [0-9a-f]{32}
,有 4 次機會可以輸入 regex,會回傳符合條件的 offset
local 測試可以用 ./rflag cakemode
會顯示隨機字串,實際執行如下:
丟 IDA 稍微標註字串然後手動 mangling 一下程式流程就蠻清楚了,但看半天都找不到漏洞…
結果連逆向都不用
因為拿 0b1xxx
去搜([89abcdef]
)可以知道所有值的最高位是 0 或 1,以此類推每次搜 1 bit,剛好 4 次可以解掉
一天又平安的過去了,感謝隊友
t510599
的凱瑞!
|
|
Flag
CakeCTF{n0b0dy_w4nt5_2_r3v3r53_RUST_pr0gr4m}
這題是 misc 吧 😿
ALDRYA
Challenge Info
I’m scared of executing a malicious ELF file. That’s why I invented this new ELF-verify system named ALDRYA.
aldrya
, sample.elf
, server.py
, README.md
Solution
README.md
有清楚的使用方法
|
|
核心邏輯在 aldrya
,會讀入一個檔案然後做檢查:
- 檔案開頭要有 ELF magic:
'FLE\x7F'
- 檔案大小限制:
[0x41<<8, 0x42<<8)
bytes - 每 0x100 bytes 計算 hash,hash 紀錄在
./sample.aldrya
通過檢查之後,直接執行該檔案(execv()
)
sample.elf
是個簡單的 puts("Hello, Aldrya!")
ELF 執行檔,它能通過檢查,所以這題變簡單很多,直接找一個 block 來改就可以了
把 shellcode 寫在 _start()
開頭,然後控制該 block 最後 32 bytes 讓 hash 值正確就可以了(能執行 shellcode 就好,後面爛掉無所謂),腳本如下:
|
|
把檔案丟到 http://transfer.sh/ ,官方 server 吃 https 會爛掉,所以把網址改成 http 上傳,就可以拿 shell
Flag
CakeCTF{jUst_cH3ck_SHA256sum_4nd_7h47's_f1n3}
這題也幾乎不用逆向,但挺有趣的