<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/6262

            0x00 前言


            “白利用”是木馬對抗主動防御類軟件的一種常用手法。國內較早一批“白利用”木馬是通過系統文件rundll32.exe啟動一個木馬dll文件,之后又發展出劫持合法軟件的dll組件來加載木馬dll的攻擊方式。

            隨著安全軟件對“白利用”的防御機制日益完善,木馬也在花樣翻新。近期,360QVM引擎團隊發現“華晨同步專家”遠控木馬家族采用了比較另類的“白利用”技術:該木馬利用白文件加載dll文件后,再次啟動白文件并卸載白進程內存空間,然后重新填充病毒代碼執行。

            這種“移花接木”的手法,使得病毒代碼均通過白進程主模塊執行,能夠繞過多數安全軟件的主動防御規則,具有較強的存活能力。以下是對此木馬詳細的技術分析:

            0x01 木馬分析


            該木馬偽裝成“美女圖片”通過社交軟件、電子郵件等方式傳播,一旦中招,電腦將被黑客發送指令執行攝像頭監控、屏幕監控等遠程控制行為。目前已知該木馬主要變種達到22個。

            enter image description here

            圖:“華晨同步專家”遠控木馬及變種

            enter image description here

            圖:木馬執行過程

            “華晨同步專家”木馬文件:

            enter image description here

            enter image description here

            美女圖片.exe:運行后會釋放update.exe、ETComm.dll、wc.dat這三個文件,并運行update.exe。這種“三合一”的打包方式相比壓縮包更利于木馬傳播。

            1. update.exe:盛大網絡的ET語音啟動程序
            2. ETComm.dll:用于劫持盛大程序的木馬dll文件
            3. wc.dat:zlib壓縮加密的遠程控制木馬

            我們首先從ETComm.dll入手分析:

            ETComm.dll分析過程

            DllMain中首先獲取模塊完整路徑

            enter image description here

            比較自身完整路徑是否為C:\$WinBackUP.H1502\BinBackup\Images\update.exe 如果不在C:\$WinBackUP.H1502\BinBackup\Images目錄下則將ETComm.dllwc.datupdate.exe拷貝過去,接下來直接進入100016A0

            enter image description here

            100016A0進來以后首先訪問C:\$WinBackUP.H1502\BinBackup\Images\wc.dat

            enter image description here

            申請一段內存后將wc.dat的內容讀進去

            enter image description here

            將讀出來的文件內容的前四位與0x36異或,得出0x14E00

            enter image description here

            將解密出來的0x14e00給到一個變量

            緊接著就申請出來一塊0x14E00大小的內存

            之后將這些數據作為參數傳遞到Zlib的解壓函數中

            enter image description here

            解出來的數據如下

            enter image description here

            由此我們可以得出wc.dat的結構,第一個DWORD存放的是UnpackFileSize,之后的數據存放的是壓縮后的文件數據,此時是最好的dump時機。

            Dump出來的文件:

            enter image description here

            接下來是為內存運行exe做準備了

            alignPEToMem函數主要作用為加載PE到內存,該函數主要內容為對其exe節數據進行初始化操作。AttachPE主要作用為創建外殼進程(盛大網絡ET語音啟動程序),并替換進程數據然后執行真正的病毒代碼

            enter image description here

            我們重點來看下AttachPE函數的行為:

            首先掛起模式再次運行C:\$WinBackUP.H1502\BinBackup\Images\update.exe

            enter image description here

            調用GetThreadContext獲取信息目標進程的線程句柄

            enter image description here

            得到的信息存放在結構體lpContext中,接著讀取了目標進程的lpContext結構體中Ebx+8的數據。

            [lpContext.Ebx+8]處存的是外殼進程的加載基址,該目標進程的基址為0x00400000

            enter image description here

            動態獲取ntdllZwUnmapViewOfSection并調用,卸載目標進程原外殼內存數據

            enter image description here

            重新在目標傀儡進程中申請傀儡代碼用到的內存,0x00400000大小為2C000

            enter image description here

            enter image description here

            內存申請成功后在傀儡進程的Context.ebx+8中寫入新的基址(因為兩個文件基址都為0x400000,所以這一步并沒有什么用,但是如果對于兩個基址不一樣的文件這一步就非常必要了)

            enter image description here

            然后在新申請的內存中寫入已經展開了所有節數據的病毒代碼,大小為0x2C000

            enter image description here

            重置運行環境中的入口地址,新的OEP為基址+0x0002A820

            enter image description here

            更新傀儡進程運行環境后恢復傀儡進程運行

            enter image description here

            至此ETComm.dll的任務已經完成,直接退出了進程

            enter image description here

            接下來我們來分析被偷梁換柱的update.exe進程

            從入口點我們可以看出是UPX加殼

            enter image description here

            直接ESP定律到程序OEP,入口點代碼可以看出是VC6.0所編譯

            enter image description here

            來到Main函數我們可以看到先是調用了一些sleep(0)

            enter image description here

            后面有一些字符串單字節賦值,我們可以看出他拼出來的字符串是Kernel32.dll和GetMoudleFileNameA,分別給到了變量LibFileName和ProcName

            enter image description here

            動態獲取GetMoudleFileNameA

            enter image description here

            通過GetMoudleFileNameA獲取到文件所在路徑后,將該路徑寫入注冊表作為啟動項,啟動項名稱為“Realtek高清晰音頻管理器”

            enter image description here

            enter image description here

            獲取資源中的名為“dll”的資源

            enter image description here

            enter image description here

            解密算法為

            xor 0xF1
            add 0xF1
            

            中間有很多sleep(0)做干擾

            enter image description here

            解出來的文件

            enter image description here

            Dump出來是dll簡單觀察發現是華晨遠控(Gh0st修改)

            enter image description here

            繼續往下就是內存加載dll。拋棄系統的LoadLibrary和GetProcAddress來自己實現則會使dll不用落地,其目的是躲避安全軟件的云查殺。

            LoadLibrary的實現過程如下:

            申請內存,寫入PE頭數據

            enter image description here

            循環拷貝各個節數據

            enter image description here

            處理重定位

            enter image description here

            讀取dll的引入表部分,加載引入表部分需要的,并填充需要的函數入口的真實地址

            enter image description here

            dll

            enter image description here

            修改各個節內存屬性,單獨設置其對應內存頁的屬性

            enter image description here

            enter image description here

            執行DllMain函數

            enter image description here

            enter image description here

            GetProcAddress實現過程:

            enter image description here

            調用自寫GetProcAddress獲取“Fi”導出函數并調用

            enter image description here

            Fi函數負責將整個遠控執行起來了。

            以下是遠控基本信息:

            遠控上線地址:dddd.ndiii.com
            端口:2012
            分組名稱:Default
            遠控官網:http://www.jinjingltsh.com/
            

            “華晨同步專家”官網號稱“擁有國家政府機關認證,與眾多安全廠商均有合作”,實際上完全是其捏造的。

            enter image description here

            enter image description here

            0x02 總結


            通過以上分析我們看出,“華晨同步專家”遠控木馬的新穎之處,在于利用白進程內存運行exe,內存運行dll,真正的病毒文件并不落地,僅存活在內存當中,具有較強的免殺能力。

            根據VirusTotal對此木馬較新變種樣本的掃描結果,57款殺毒軟件中有17款可以將其檢出,檢出率約為30%:

            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>

                      亚洲欧美在线