Tags: reversing tetris 

Rating:

We can execute the binary which yields a binary file output.tetr. Using xxd output.tetr reveals no flag unfortunately.

We analyze the executable with ghidra. Basically, the program takes a string encoding Tetris game states ([https://github.com/knewjade/tetris-fumen](https://github.com/knewjade/tetris-fumen), [https://harddrop.com/wiki/SRS#How_Guideline_SRS_Really_Works](https://harddrop.com/wiki/SRS#How_Guideline_SRS_Really_Works)), parses it into internal structures. Then the game states are written into a file using a simple run-length encoding (type, len). To get the flag, we have to read the file secret.tetr and reconstruct the tetris frames and feed it into [https://harddrop.com/fumen/](https://harddrop.com/fumen/) frame by frame. The page then calculates the flag in the v115 tetris format.

Full write-up: [https://github.com/jlp1701/utctf-2021/tree/master/re/file_tetr](https://github.com/jlp1701/utctf-2021/tree/master/re/file_tetr)

Original writeup (https://github.com/jlp1701/utctf-2021/tree/master/re/file_tetr).