-
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
netcat
to connect to remote service. -
The service generates us a random number or outputs
wrong option
if anything else than1
is 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 value1
is used as input. -
Otherwise, it prints
wrong option
on the screen. -
But in between this
if-else
, we have aelse-if
condition that compares our input with0x539
. -
If the values are equal, we see that the
FLAG
environment 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}