Protostar/Stack 5

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

We write our first real exploit to get root access. Solving stack5 from with a simple Buffer Overflow and shellcode.

Stack5 is a standard buffer overflow, this time introducing shellcode.

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

At this point in time, it might be easier to use someone elses shellcode
If debugging the shellcode, use \xcc (int3) to stop the program executing and return to the debugger
remove the int3s once your shellcode is done.


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

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 video shows you how to take over control of a program with a buffer overflow

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