I'm learning exploitation, and I downloaded some execve("/bin/sh") shellcode from exploit-db to use it in simple buffer overflow example. When I execute the program I am getting segmentation fault. I'm running this on kali linux in vmware.
Here is code:
#include<stdio.h>
#include<string.h>
const char sc[] = \
"\x01\x30\x8f\xe2\x13\xff\x2f\xe1"
"\x03\xa0\x52\x40\xc2\x71\x05\xb4"
"\x69\x46\x0b\x27\x01\xdf\x7f\x40"
"\x2f\x62\x69\x6e\x2f\x73\x68\x41";
void main()
{
printf("Shellcode Length: %d\n", strlen(sc));
((void(*)(void))sc)();
}
Here is how it is compiled:
gcc -z execstack -fno-stack-protector shell.c -o shell
- May it be caused by running it on vmware?
- Is it possible that there is something wrong with shellcode but I am getting SIGSEGV instead of SIGILL?
- Is there something wrong in the way that I execute code in this C program?