0x70 0x69 0x63 0x6f 0x43 0x54 0x46 0x7b 0x34 0x5f 0x64 0x31 0x34 0x6d 0x30 0x6e 0x64 0x5f 0x31 0x6e 0x5f 0x37 0x68 0x33 0x5f 0x72 0x30 0x75 0x67 0x68 0x5f 0x63 0x65 0x34 0x62 0x35 0x64 0x35 0x62 0x7d
, which is a series of hexidecimal numberswin
to call the win
function. Also, the hint says that Can you do what win
does with your input to the program?, and what win
does is printing the flag.open('flag.txt', 'r').read()
. So, we can print out the flag byprint(open('flag.txt', 'r').read())
, the complete code will be like this:*NOTE: If there's one more pair of brackets after the function, it(the function) will still be processed. For example:
print(open('flag.txt', 'r').read())
is too long for new value of variable
, so you'll get Illegal value
in response.
Also, creating a new variable doesn't work either, since there's no function number for the newly created function, and read_variable
function is only able to print the content of the function instead of executing it, like this:
objdump
to access the location of the function win
:and you'll see the location of win
, which is 0x000000000040129e
(Ghidra will work as well, I assume)
2. Send the location to netcat
In the beginning, I thought what I should do is to convert win
from string to hex
but it failed, like this:
Then I saw the hint: How can you find the address that win is at?. I looked into the source code again, and found that the function seemed to be called by its address: void (*foo)(void) = (void (*)())val; foo();
, so I turned to look for the address