Publié par IoNAce le 28/02/2008
Il y a plusieurs solutions que j'ai testées afin d'exécuter des shellcodes mais aucunes ne fonctionnent.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include <stdio.h>
#include <string.h>
int main()
{
char sh[] = "\x31\xc0\x31\xdb\x31\xc9\x31\xd2\xb0\x04\xb3\x01\xeb\x05"
"\x59\xb2\x0d\xcd\x80\xe8\xf6\xff\xff\xffHello World !";
asm("jmp %esp");
return 0;
}
/******************/
char sh[] = "\x31\xc0\x31\xdb\x31\xc9\x31\xd2\xb0\x04\xb3\x01\xeb\x05"
"\x59\xb2\x0d\xcd\x80\xe8\xf6\xff\xff\xffHello World !";
int main()
{
printf("taille : %d\n",sizeof(sh)-1); //au cas où on veuille afficher sa taille
int *ret; // le -1 est parce qu'il ne faut pas tenir compte du 0 terminal
*( (int *) &ret + 2) = (int) sh;
}
/******************/
char sh[] = "\x31\xc0\x31\xdb\x31\xc9\x31\xd2\xb0\x04\xb3\x01\xeb\x05"
"\x59\xb2\x0d\xcd\x80\xe8\xf6\xff\xff\xffHello World !";
int main()
{
void (f*) () = (void *) sh;
f();
return 0;
}