Protostar/Stack 4

If you get stuck, you can watch the solution and explanation here:

This video shows you how to take over control of a program with a buffer overflow

Stack4 takes a look at overwriting saved EIP and standard buffer overflows.

This level is at /opt/protostar/bin/stack4

A variety of introductory papers into buffer overflows may help.
gdb lets you do "run < input"
EIP is not directly after the end of buffer, compiler padding can also increase the size.


#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

void win()
  printf("code flow successfully changed\n");

int main(int argc, char **argv)
  char buffer[64];


See also

This video introduces, how to connect to the VM with ssh and explains what setuid binaries are.

We will write our first Buffer Overflow for the stack0 level of

This is a mirror. Copyright and original can be found here: