Follow us on twitter

Donate Bitcoins

About

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

Hints:

  • If you are unfamiliar with the hexadecimal being displayed, "man ascii" is your friend.
  • Protostar is little endian

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

Source code

 1#include <stdlib.h>
 2#include <unistd.h>
 3#include <stdio.h>
 4#include <string.h>
 5
 6int main(int argc, char **argv)
 7{
 8  volatile int modified;
 9  char buffer[64];
10
11  if(argc == 1) {
12    errx(1, "please specify an argument\n");
13  }
14
15  modified = 0;
16  strcpy(buffer, argv[1]);
17
18  if(modified == 0x61626364) {
19    printf("you have correctly got the variable to the right value\n");
20  } else {
21    printf("Try again, you got 0x%08x\n", modified);
22  }
23}

Discussion