heap-zero
heap-zero is the first heap exploitation exercise from the phoenix vm from exploit education
Source code
Looking at the source code we see two calls to malloc(), which allocates space in the heap for further use. We might also observe that it uses strcpy() to copy an argument passed from the command line to the first allocated space. As we already know, using strcpy() might be dangerous because it won't stop the user from providing input larger than the allocated space, allowing a heap overflow to occur. After that, the program will store a pointer to the nowinner function in the second allocated space and then calls whatever functions it reads from this pointer.
In theory we are unable to control the value of fp, since it isn't set based on user input, but if we exploit a heap overflow on the first chunk (to which our input is copied) we might overwrite the value of fp and control the execution flow.
The challenge is available in a varity of architectures, so there will be a different solution to each of them, but all based on the same principle, though I recomend checking the i486 one out first because it's way more didactic than all the others, since I won't repeat the same information over and over again when I'm doing the other versions.
Summary
i486Last updated