2021 Balsn CTF - Cheater
Sun, Nov 28, 2021
2-minute read
題目:Cheater
Cheater
407 points / 6 solves


Cheater
Challenge Info
1 2 3 4 5 6 7 8As a CTF player, how do I sovle challenges and get the flags ? NO, I don't ! I infiltrate spies into the CTF origanizers' family. Their girlfriend, boyfriend, wife, husband, adopted son and even their pet cat ! Spies will try to borrow their computer for playing a tiny tiny pixel-art video game... That's a trap! The game is actually a interface to contact headquarter for futher commands! But a double secret agent stole my flag! Haha, that's a bait, help me to found out which flag was leak so I can target the perpetrator. The story, names, and incidents portrayed in this description are fictitious.Attachment:
cheater.zipAuthor: nini Verifier: how2hack(3hr)
Solution
解壓縮後,比較重要的有 flag-online.exe, SUS.pcapng
flag-online.exe 是 nim 開發的遊戲,總共有 3 個畫面:
- 0:一開始的 BALSN press space to START
- 1:(很難的)彈幕遊戲
- 2:輸入文字介面
畫面 0

畫面 1

畫面 2

遊戲畫面由 currentState__Wc09cKuZYDia4B4v9cw7TNVA(flag-online.exe+0x141334)決定,直接改數值就可以切換
畫面的相關邏輯在 gameUpdate__MMnayPNQfg8okpCrPMJHoA,可以看到每個畫面都有對應一個 update function
其中畫面 2 的是 update__1eM9auCeT70xrbC2fzp7DfQ_2,它是根據 btn__YHtl8a4TnIMBu5x8edbrZQ 決定程式行為:
- 0:Arrow Left
- 1:Arrow Right
- 2:Arrow Up
- 3:Arrow Down
- 4:Space
- 5:對
http://flag-online.balsn.tw:7414/antibalsn/gameOver/<payload>發送請求 - 9:對
http://flag-online.balsn.tw:7414/antibalsn/gameState發送請求,然後把回傳資料顯示在畫面上
另外,在 init__1eM9auCeT70xrbC2fzp7DfQ 時會對 http://flag-online.balsn.tw:7414/antibalsn/antibalsn/regist 發請求
對 server 交互的資料都經過編碼跟加密:
- 編碼是 base64
- 加解密不太清楚,它們分別是:
encrypt__l7V4zu461RHdTkKYdKDbtwdecrypt__yTNT7OFdw4VeC8mj9be88kA_part_0
可以從 SUS.pcapng 拿到每次 client server 交互的 payload
btn(9) 會把 payload 拿去解密並顯示,所以簡單模擬一個 server 照順序把 payload 送給 client
client(flag-online.exe):
- 先切換到畫面 2
- 把
btn(9)(flag-online.exe+0x73845)附近的流程改一下,讓它一直對http://flag-online.balsn.tw:7414/antibalsn/gameState要 payload
server:
| |
所有解密完的內容會顯示在畫面上,裡面包含 flag

Flag
BALSN{niconjconi_this_is_an_onL1N3_G4ME!!=_=}