I am running FedoraCore6 as instructed by the prof. I am trying to simply run this shellcode that is provided by the lab instructions and I keep on getting a Segmentation fault..We are told we can either compile with the stack gaurd turned off by using the command gcc-fno-stack-protector call_shellcode.c either way wether I just compile the code ussing gcc -o shell call_callshellcode.c or use the -fno-stack-protector command I get a segmentation fault when launching the code isntead of a shell being invoked..Any help? So I am provided with code for this lab as follows:
#include <stdlib.h>
#include <stdio.h>
const char code[] =
"\x31\xc0"
"\x50"
"\x68""//sh"
"\x68""\bin"
"\x89\xe3"
"\x50"
"\x53"
"\x89\xe1"
"\x99"
"\xb0\x0b"
"\xcd\x80"
;
int main(int argc, char **argv)
{
char buf[sizeof(code)];
strcpy(buf, code);
((void(*) ( ))buf)();
}