21 - horcruxes
Last updated
Was this helpful?
Last updated
Was this helpful?
Voldemort concealed his splitted soul inside 7 horcruxes. Find all horcruxes, and ROP it!
author: jiwon choi
ssh horcruxes@pwnable.kr -p2222 (pw:guest)
Lets Examine the program first.
It asks us to select a number from the menu and then how much XP did we earn. Not very informative. We copied the binary to our machine and disassembled it. This is main:
An alarm is set to throw us out after 60 seconds
The message about Voldemort is printed
init_ABCDEFG
is called
Some security rules are set [probably to prevent us from corrupting the machine once we achieve code execution]
ropme
is called
Let's take a look at init_ABCDEFG
:
Seven integers named 'a' to 'g' are set to a random int. Their sum is saved in 'sum'. These variables have a global scope. Let's take a look at ropme
:
The functions 'A' - 'G' print the values of the variables mentioned above. The EXP input uses gets
which is great news, this is where we're going to ROP.
But wait, can't we just redirect the function to print the flag?
All of the addresses in ropme
contain 0a
. Once puts
receives \n
it halts, which means we can't jump to any position within ropme
.
We created a ROP chain that jumps from A
to G
one after the other. It contains:
120 character buffer that overrides the stack up to ebp
[included].
The addresses of all of the functions A
to G
. Finding the addresses is easy with a disassembler. They are concatenated to each other as none of these functions require parameters.
The address where ropme
is called [since we can't resume execution within ropme].
Now we can obtain a
to g
and calculate their sum [with modulus in case the sum surpasses MAX or MIN int].
To get a better understanding check out our .