# 0x0C. Defeat Indirect Call - Anti-Analysis Technique in Darkside Ransomware [TOC] ## 前言 近期發生在美國石油公司Colonial Pipeline的一場攻擊,攻擊者使用了Darkside的Ransomware-as-a-service(RaaS)來完成這場攻擊 最後Colonial Pipeline支付了440萬美金給攻擊者,這世界真是做黑的賺的多啊... <br> 接下來來看一下Sample (*仍然是小魯的不專業分析*) SHA1: `c511ae4d80aaa281c610190aa13630de61ca714c` 這隻Sample是放在any.run上面的, link如下 https://app.any.run/tasks/e7a712f5-961a-45b4-a7e5-a0f7196113a5/# Sandbox執行後 不意外的,電腦許多檔案被加密了並出現勒索README.TXT <br> ## Anti-Analysis ### Dynamic Load API 下載Sample後,丟去IDA看看 不意外的,只有三個Function,無法藉由靜態分析得知所有WinAPI Function - GetProcAddress - LoadLivraryA - ExitProcess ![](https://i.imgur.com/0DeJj5h.png) 對`LoadLibraryA`做Cross Reference,發現`sub_40182A`多次呼叫LoadLibraryA 可以判斷剩餘API就是在此做動態載入 ![](https://i.imgur.com/Rr8tppb.png =35%x) ### Indirect Call 除了動態載入外,會出現很多Indirect Call如下 `call dword_410EA6` `call off_6E0EBA` 點進`dword`,`offset`看,沒有數值,無法知道到底呼叫什麼,只能透過動態分析來找出確切Function ![](https://i.imgur.com/B13mlkA.png =80%x) 同時,Indirect Call無法直接利用scylla等工具Rebuild IAT Table IDA針對此狀況提供了一個好用的script `renimp.idc`,雖然不能Rebuild IAT,但可以知道呼叫什麼,並且重新命名這些不知其意的變數名稱 ### Defect Indirect Call 嘗試下breakpoint用IDA執行,breakpoint設定在執行完`sub_40182A` 以確保API都被載入 回去看dword的地方,可以看到已經自動變成function name(有些需要手動轉換) ![](https://i.imgur.com/yUd7eiP.png =80%x) 但這樣自動轉換是暫時的,停止執行後,又會回到當初的`dword`,`offset`等variable 這時使用`renimp.idc`來幫助分析 選取function後,按下`Alt+F7`, 選擇`renimp.idc` 原本難看的dword,offset變成漂亮的Function name啦! ![](https://i.imgur.com/Y036ryy.png) 關於`renimp.idc`, 可以參考下面的範例 https://malware.news/t/reverse-engineering-malware-trickbot-part-2-loader/15758 <br> ## Little More Analysis 在得到WinAPI後,接下來的分析就會相對容易了 這邊粗淺地貼上幾個有趣的WinAPI以及其目的 - Query user privilege:Privilege Escalation attempt ![](https://i.imgur.com/G9ynmEl.png =50%x) - Query host information and Impersonation ![](https://i.imgur.com/nB9BKyU.png =60%x) - Token impersonation and enumerate network share ![](https://i.imgur.com/MZnvCRm.png) - New process creation ![](https://i.imgur.com/wCcxwc6.png) <br> ## 更多分析 這邊分享一些比較精彩的分析給大家參考,裡面提到了更多加密手法以及詳細資訊 https://www.nozominetworks.com/blog/colonial-pipeline-ransomware-attack-revealing-how-darkside-works/ https://www.fireeye.com/blog/threat-research/2021/05/shining-a-light-on-darkside-ransomware-operations.html https://unit42.paloaltonetworks.com/darkside-ransomware/ [-0xbc](https://hackmd.io/@0xbc000) ###### tags: `Malware Analysis` `Reverse Engineering` `tutorials`