Buttons
ファイル Buttons.jar
が与えられた。
JD-GUIで逆コンパイルしてみると、printFlag
関数があったが、この関数の処理は移動のログを参照するようだった。
java -jar Buttons.jar
コマンドで実行してみると、ボタンが大量にある以下の画面が表示された。
適当にボタンを押してくと、押したボタンが無効化される場合と、「Illegal move, you lose」と書かれたダイアログが出て初期状態に戻る場合があった。
A file Buttons.jar
was given.
Decompiling via JD-GUI, I found a function printFlag
, but I also found that the function uses the log of movements.
Executing the program using a command java -jar Buttons.jar
, it showed this window with a lot of buttons.
Pressing the buttons randomly, I found that there are cases where the pressed button is disabled, and ones where a dialog saying "Illegal move, you lose" appears and the status is reset to the intial one.

逆コンパイル結果をさらに読むと、isLegalMove
関数より、以下の条件を全て満たすボタンを押すことで進めていけそうであることがわかった。
- 前回押したボタン (最初に押すボタンについては、左上の最初から無効になっているボタン) と隣接している。(4方向)
grid
の対応する要素が 0
である。
そこで、逆コンパイル結果から grid
のデータを取り出し、CyberChefで見やすいように加工した。
With further reading of the result of decompilation, I found that pressing buttons that satisfy all of these conditions will move the status forward.
- Adjacent to the button previously pressed (regarding to the first button to press, the initially disabled button in the top left) in one of the 4 directions.
- The corresponding element of
grid
is 0
.
Then, I took out the data for grid
and processed it on CyberChef to improve readability.
Find / Replace, 2 more - CyberChef
この結果を参考に 0
の位置のボタンを押していき、右下の旗のマークのボタンを押すと、flagが表示された。
また、標準出力にもflagが出力された。
Seeing the result of this, I pressed buttons that correspond to 0
. The flag appeared when I pressed the button with a flag mark in the bottom right.
The flag was also printed to the standard output.
buckeye{am4z1ng_j0b_y0u_b1g_j4va_h4ck3r}
writeup by MikeCAT
BuckeyeCTF 2021