Follow us on twitter

Donate Bitcoins

About

This level introduces the concept that memory can be accessed outside of its allocated region, how the stack variables are laid out, and that modifying outside of the allocated memory can modify program execution.

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

Source code

 1#include <stdlib.h>
 2#include <unistd.h>
 3#include <stdio.h>
 4
 5int main(int argc, char **argv)
 6{
 7  volatile int modified;
 8  char buffer[64];
 9
10  modified = 0;
11  gets(buffer);
12
13  if(modified != 0) {
14    printf("you have changed the 'modified' variable\n");
15  } else {
16    printf("Try again?\n");
17  }
18}

Discussion