Protostar/Stack 1

This level looks at the concept of modifying variables to specific values in the program, and how the variables are laid out in memory.

This level is at /opt/protostar/bin/stack1
Hints:
If you are unfamiliar with the hexadecimal being displayed, "man ascii" is your friend.
Also Protostar is little endian.

stack1.c

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

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

  if(argc == 1) {
      errx(1, "please specify an argument\n");
  }

  modified = 0;
  strcpy(buffer, argv[1]);

  if(modified == 0x61626364) {
      printf("you have correctly got the variable to the right value\n");
  } else {
      printf("Try again, you got 0x%08x\n", modified);
  }
}

See also

This video introduces http://exploit-exercises.com, 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 exploit-exercises.com.

This is a mirror. Copyright and original can be found here: exploit-exercises.com/protostar/stack1/