Hi,
I was just learning about buffer overflow attacks... I was curious as to how to generate a simple shellcode. For example, I've written two codes - One is the typical program that has a vulnerability inside and the other is the shellcode.
main program:
void test();
int main() {
test();
return 0;
}
void test() {
int *ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
I was thinking of putting the shellcode into the shellcode found in the end which is a character array.
And as for the shellcode generation, I've written something like:
#include <unistd.h>
int main() {
char buf[]="Hello World";
write(1,buf,sizeof(buf));
exit(0);
}
But I don't know how to generate the shellcode from this so that I can put it in the original program. Can someone please guide me on how to achieve this?