-
we’re given what seems to be a binary file that we need to reverse engineer.
-
first, let’s interact with the service we’re given.
-
We can use
netcatto connect to remote service. -
The service generates us a random number or outputs
wrong optionif anything else than1is sent as input.
- Below, I’ve opened the file we’re given in
ghidra.
-
The program seems to generate and print a random number by calling the
rand()function when value1is used as input. -
Otherwise, it prints
wrong optionon the screen. -
But in between this
if-else, we have aelse-ifcondition that compares our input with0x539. -
If the values are equal, we see that the
FLAGenvironment table is retrieved and printed. -
As a reference, I have highlighted this in the image above. 0x539 in hexa is 1337 in decimal.
-
When we introduce this value as input, we receive the flag.
FLAG : flag{l3{REDATCTED}ag}