B1ll_Gat35 (Reverse Engineering)
Can you reverse this Windows Binary?
添付ファイル
・win-exec-1.exe
とりあえず実行する。
$ ./win-exec-1.exe
Input a number between 1 and 5 digits: 3
Initializing...
Enter the correct key to get the access codes: 39393939
Incorrect key. Try again.
stringsコマンドで確認したところ、フラグフォーマットがPICOCTF{...}となっていた。
C:\Users\abush\Desktop\pico-win-problems\win-exec-1.pdb
%llu
The key is:
%s%s
%llu
PICOCTF{These are the access codes to the vault:
%s%s%s
Input a number between 1 and 5 digits:
Number too big. Try again.
Initializing...
Enter the correct key to get the access codes:
Incorrect key. Try again.
Correct input. Printing flag:
Ollydbgを使って解析する。
$ file win-exec-1.exe
win-exec-1.exe: PE32 executable (console) Intel 80386, for MS Windows
"Input a number between 1 and 5 digits:"を出力するあたりにブレイクポイントを設定し、その後はステップ実行する。
stringsコマンドの結果より、"The key is:"でkeyが出力されることが分かる。
1で初期化して、どこかに出力されるはずのkeyを探して入力すれば、フラグが出てくるはずである。

初期化処理が終わったあたりでメモリダンプ画面に"The key is: 4253360"と出てきた。
"Enter the correct key to get the access codes:"のところで入力する。ただし、必要なのはkeyではなくaccess codesなのでThe key is: 4253360と入力してみる。
フラグが得られた。
PICOCTF{These are the access codes to the vault: 1063340}
