2020 AIS3 EOF Final - Extensive Flag Checker
題目:Extensive Flag Checker
2020 AIS3 EOF Final 的最後一題啦
Extensive Flag Checker (350)
Challenge Info
I found a flag checker from my grandma’s computer. Can you check it for me?
Download: https://drive.google.com/file/d/1S3ZQsug3-KtX_Ob-J0jH7GZA-xUXF47p/view?usp=sharing (de-compress password: notinfected)
Author: Inndy
ExtensiveFlagChecker.exe
Solution
實際執行,是個有 GUI 的 flag checker
輸入框在很下面,螢幕不夠大會看不到XD,需要的話可以把它移上面一點
.Net 老樣子丟 dnSpy,排除掉假 flag 跟明顯不可能的 hash 檢查,能追到一個 check
function
它會先把使用者輸入寫進 "C:\\Windows\\Temp\\flag.txt"
,然後呼叫 CreateThread
執行 Resources
中的 shellcode(native_checker
)
shellcode 首先會做 decode(self modifying),對當前執行的 instruction 後面的所有內容 ^
, +
或 -
一個定值,總共 200 次,最後停在 base + 0x19c8
(可以設定一個硬體斷點)
不想寫手動 decode 腳本,我的作法是用 x64dbg 先斷在 CreateThread
,然後手動改 RIP 跳進 shellcode,再 F9 讓程式爛掉,就可以把完整的 shellcode dump 出來(不知道有沒有更好的方法)
decode 完之後會去爬 ntdll.dll
呼叫一些函式(沒仔細追XD),總之是把 "C:\\Windows\\Temp\\flag.txt"
讀進來
接下來是取輸入的 3 bytes 出來做 hash 然後檢查,總共 43 次(最後一次明顯是 \x00
不重要)
3 bytes 所以輕鬆爆破,寫腳本搞定:
|
|
Flag
AIS3{So you had some skill about reverse windows shellcode. Contact inndy.lin@cycarrier.com for an internship if you like. :D}
其實 ARAY4 還比較難(麻煩)一些,為什麼當初沒有解出來QQ