Its Overflowing

Oh no we have found a vulnerable app in out system, help me find the broken part

As the title suggests, the challenge is a buffer overflow challenge.

Since we are given the code as well,

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

void win() {
    printf("Oh No");
    system("cat flag.txt");
}
void main() {
    char flag[150];
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stdin, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);
    printf("Enter the flag: ");
    fgets(flag, 1000, stdin);
}

We can find the buffer.

Thus, I find the ret address to be 0x0000000000401016

By using objdump, I can find teh address of the win function to be 0000000000401166

Since we have the buffer, the win address and the ret address, we can craft our solve script

Thus giving us the flag GCTF24{0h_OoPs_0V3rFlOweD}

Last updated