Follow us on twitter

About

This level moves on from format1 and shows how specific values can be written in memory.

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

Source code

 1#include <stdlib.h>
 2#include <unistd.h>
 3#include <stdio.h>
 4#include <string.h>
 5
 6int target;
 7
 8void vuln()
 9{
10  char buffer[512];
11
12  fgets(buffer, sizeof(buffer), stdin);
13  printf(buffer);
14  
15  if(target == 64) {
16    printf("you have modified the target :)\n");
17  } else {
18    printf("target is %d :(\n", target);
19  }
20}
21
22int main(int argc, char **argv)
23{
24  vuln();
25}

Discussion