Code:
firas@itsuki ~ % cat test.c
#include <string.h>
#include <stdio.h>
void foo(const char* input)
{
char buf[10];
strcpy(buf, input);
}
void bar(void)
{
printf("Augh! I've been hacked!\n");
}
int main(void)
{
char input[] = {'1', '2',
'1', '2', '3', '4',
'1', '2', '3', '4',
'1', '2', '3', '4',
'1', '2', '3', '4',
'1', '2', '3', '4',
0x56, 0x84, 0x04, 0x08, '\0'};
foo(input);
return 0;
}
firas@itsuki ~ % gcc -fno-stack-protector -o test test.c
firas@itsuki ~ % ./test
Augh! I've been hacked!
zsh: segmentation fault (core dumped) ./test
Still segfaults though... I'm not an expert either, so I would have to investigate it further but I don't have a lot of time on my hands right now...
Bookmarks