接續昨天的內容,今天會分享 Boss Of The SOC v1 剩下的 Q21~ Q32 的解題過程,學習 Threat Hunting 的流程,解題平台同樣會使用 CyberDefender
本次實作實驗聚焦在 APT(高階持續性威脅)情境與勒索軟體情境。你將扮演 Alice Bluebird 的角色——剛被聘為 Wayne Enterprises 的 SOC 分析師,負責偵測與防禦各類網路攻擊。
今天是 Alice 在 Wayne Enterprises 安全部門(Security Operations Center,SOC)的第一天。Lucius 叫 Alice 坐下並給她第一個任務:一份來自高譚市警察局(Gotham City Police Department, GCPD)的備忘錄。GCPD 發現線上有證據(http://pastebin.com/Gw6dWjS9)顯示網站 www.imreallynotbatman.com 在 Wayne Enterprises 的 IP 位址空間內被入侵。該駭客組織有多重目標……但他們的作案手法之一是篡改網站以羞辱被害者。Lucius 要求 Alice 判定 www.imreallynotbatman.com(Wayne 企業執行長的個人部落格)是否確實遭到入侵。
在此情境中,使用者社群在瀏覽 Wayne Enterprises 網站時回報看到下列被篡改的圖片,且部分回報提到「P01s0n1vy」。若你不熟悉,P01s0n1vy 是一個曾針對 Wayne Enterprises 的 APT 組織。你作為 Alice 的目標是調查該網站篡改事件,並嘗試依照 Lockheed Martin Kill Chain 重建攻擊流程。
在第二個情境中,你的一位使用者在 Windows 桌面上看到一張圖片,表示系統上的檔案已被加密,必須付款才能取回檔案。看起來 Wayne Enterprises 有一台主機感染了 Cerber 勒索軟體,你的目標是調查這起勒索事件。
Q21 : Ransomware: What fully qualified domain name (FQDN) makes the Cerber ransomware attempt to direct the user to at the end of its encryption phase?
題目敘述說惡意程式會讓使用者嘗試去請求 domain ,要找出FQDN
我想要先知道內部有哪些 IP 有在進行 DNS 查詢
index="botsv1" sourcetype="stream:dns"
| table src_ip
| stats count by src_ip
這邊知道192.168.2.50、192.168.250.100、192.168.250.20、192.168.250.40、192.168.250.70 這些內部 IP 有在進行 DNS 查詢,接下來我先看192.168.250.0/24 內 IP 查詢了哪些 domain,
index="botsv1" sourcetype="stream:dns" src_ip=192.168.250.0/24
| table src_ip,dest_ip,query{}
接下來會有很多其他的 DNS 記錄出來 我們可以點擊不可能是答案的 FQDN ,然後選擇 Exclude from result ,然後它就會在 Search 欄位中自動產出將此FQDN 排除查詢的語法。
經過層層篩選後最後查詢如下
index="botsv1" sourcetype="stream:dns" src_ip=192.168.250.0/24 "query{}"!="*.in-addr.arpa" "query{}"!="demo-01" "query{}"!="*.authdns.ripe.net" "query{}"!="*.microsoft.com" "query{}"=*.*.* "query{}"!="*.waynecorpinc.local" "query{}"!="dns.msftncsi.com" "query{}"!="*.globalrootservers.net"
| table src_ip,dest_ip,query{}
這邊可以看到 cerberhhyed5frqa.xmfir0.win 這個 FQDN,而這個網址在情境的圖片上有出現,因此是這題的答案
ans : cerberhhyed5frqa.xmfir0.win
Q22 : Ransomware: What was the most likely IP address of we8105desk in 24AUG2016?
題目想要問 we8105desk 這個 host 它最有可能的 IP 位置是什麼,時間限制在2016/08/24 中
首先先來調整時間,選擇時間並選擇 DataRange,調整為查詢08/24/2016 到 08/25/2016這段時間的資料
接下來查詢 host 為 we8105desk 的 source IP 記錄,因為是查詢 Sysmon 來源的關係所以是使用 SourceIp 當作查詢來源 IP
index=botsv1 host=we8105desk source=WinEventLog:Microsoft-Windows-Sysmon/Operational
| stats count by SourceIp
| sort -count
這邊可以看到答案是 192.168.250.100
ans : 192.168.250.100
Q23 : Ransomware: Amongst the Suricata signatures that detected the Cerber malware, which one alerted the fewest number of times? Submit ONLY the signature ID value as the answer. (No punctuation, just 7 integers.)
這題想要問 Suricata 產生的警報,當中關於 Cerber malware 出現最少的 signature 是哪一個
可以用以下的語法查詢,將 signature 與 signature_id 抓出來
index=botsv1 sourcetype=suricata Cerber
| table alert.signature alert.signature_id
可以很明顯的看到 ETPRO TROJAN Ransomware/Cerber Checkin 2
這個 signature 只出現一次,而它的 id 為2816763 ,則為答案
ans : 2816763
Q24 : Ransomware: The VBScript found in question 25 launches 121214.tmp. What is the ParentProcessId of this initial launch?
這題需要先Q25,可以先去看 Q25 的解題過程
題目敘述說在Q25 找到 關於VBScript 是 121214.tmp被執行了,請問啟動這個VBScript 的父進程 ID 是什麼?
可以先將ParentImage、ParentProcessId以及CommandLine 抓出來查看
index=botsv1 sourcetype=xmlwineventlog *.vbs
| table ParentImage ParentProcessId CommandLine
這邊可以很清楚的看到啟動121214.tmp 的父進程是 wscript.exe ,它的ID 為3968,這正是我們的答案
ans : 3968
Q25 : Ransomware: During the initial Cerber infection a VB script is run. The entire script from this execution, pre-pended by the name of the launching .exe, can be found in a field in Splunk. What is the length in characters of the value of this field?
題目敘述說當 Cerber 惡意程式執行時,初始會先執行 VB script,而這個 VB script 的產生包含前面啟動它的 exe 檔 可以在 Splunk 的其中一個欄位找到,最後問這個欄位裡面的值總共有多少 characters
看到題目敘述,可以直接聯想到的是 CommandLine 欄位,所以我們先把 EventLog 的 CommandLine 欄位抓出來,並且限制檔名為 .vbs
index=botsv1 sourcetype=xmlwineventlog *.vbs
| table CommandLine
可以看到下面一大串的 cmd.exe........ 並且後面接 GSI=%APPDATA%\%RANDOM%.vbs
這邊就可以確定是題目所說。
接下來要計算裡面有多少字元,使用的是 eval 的 len 函式
index=botsv1 sourcetype=xmlwineventlog *.vbs
| eval cmdlenght=len(CommandLine)
| table CommandLine cmdlenght
這邊它幫我們計算出答案為4490
ans : 4490
Q26 : Ransomware: The malware downloads a file that contains the Cerber ransomware crypto code. What is the name of that file?
題目敘述說惡意程式去下載一個包含 Cerber 勒索病毒加密程式碼的檔案,它的檔案名稱是什麼
我先把 192.168.250.100 (we8105desk) HTTP 的 GET 請求全部先抓下來
index=botsv1 source="stream:http" src_ip=192.168.250.100 http_method=GET
| table src_ip,dest_ip,site,src_headers
當中最可疑的是它向 solidaritedeproximite.org
請求一個 mhtr.jpg 檔案
我們單獨看一下關於有包含 mhtr.jpg 的記錄
index=botsv1 mhtr.jpg
發現到有 fgt_utm
的記錄跳出來,在 Splunk 中通常指的是來自 FortiGate 防火牆的 Unified Threat Management 安全日誌類型的 sourcetype,用來記錄防毒、入侵防禦、網頁過濾等安全事件。
我們使用 fgt_utm 記錄,並把 filename,msg,analyticscksum 欄位抓出來
index=botsv1 sourcetype="fgt_utm" mhtr.jpg
| table filename,msg,analyticscksum
可以看到它偵測 mhtr.jpg 為惡意檔案,並且有 sha256 給我們,我們將它丟入 VirusTotal
可以看到它是惡意程式,那 mhtr.jpg 就是我們的答案
ans : mhtr.jpg
Q27 : Ransomware: Now that you know the name of the ransomware's encryptor file, what obfuscation technique does it likely use?
題目問 mhtr.jpg 使用了何種混淆技術
jpg 可以被辨識出惡意程式,有很大的可能使用了隱寫術 (Steganography),將惡意程式隱藏在圖片中,因此答案就是 Steganography
ans : Steganography
Q28 : Ransomware: What is the name of the USB key inserted by Bob Smith?
題目問 Bob Smith 插入的 USB 名稱是什麼
在 Splunk 中提供了一個 sourcetype,名稱為 winregistry,用來監控 Windows 註冊表 key/value 的建立、修改、刪除等操作。
另外關於 USB 的其中一個註冊表路徑會在 SYSTEM\ControlSet001\USBSTOR
,主要用途是記錄曾經連接過的 USB 裝置資訊,例如製造商、產品、序號、FriendlyName 等等
因此我們將 USBSTOR
底下的 value 抓出來,並且用 dedup 將重複的 value 刪除,只保留第一筆出來的值
index=botsv1 source="winregistry" host=we8105desk USBSTOR
| table registry_value_data | dedup registry_value_data
這邊就可以看到 USB 的名稱為 MIRANDA_PRI
ans : MIRANDA_PRI
Q29 : Ransomware: Bob Smith's workstation (we8105desk) was connected to a file server during the ransomware outbreak. What is the IP address of the file server?
題目敘述 Bob Smith's workstation 在 ransomware 執行期間去連線了 file server,請問 file server 的 IP 是什麼?
連線 file server 的 protocol 可能會有 SMB 或者 FTP,FTP 是空的,那我們可以著重去看 SMB
index=botsv1 sourcetype="stream:smb" src_ip=192.168.250.100
| table dest_ip
| dedup dest_ip
接下來要再更確認一點,file server 可能會進行登入,因此我們加上 login="bob.smith"
index=botsv1 sourcetype="stream:smb" src_ip=192.168.250.100 login="bob.smith"
| table dest_ip
| dedup dest_ip
這樣就確定了 192.168.250.20 是 file server
ans : 192.168.250.20
Q30 : Ransomware: How many distinct PDFs did the ransomware encrypt on the remote file server?
題目問有多少個遠端 pdf 被加密了
我們在上一題知道 file server 的 IP 為 192.168.250.20,我們另外先拿一下它的 domain name
index=botsv1 sourcetype="stream:smb" src_ip=192.168.250.100 dest_ip=192.168.250.20 path=*
| table path
這邊得知了 domain name 為 we9041srv.waynecorpinc.local
首先我先搜尋 wineventlog 中有沒有關於 .pdf 的記錄
index=botsv1 sourcetype="wineventlog" *.pdf
發現到有,並且是從 192.168.250.100 請求 we9041srv.waynecorpinc.local 的一個 pdf
因此我們將所有關於這個的記錄抓下來,並用 stats 中的 dc 幫我們算總共有幾個檔案
index=botsv1 sourcetype="wineventlog" *.pdf EventCode=5145 Source_Address=192.168.250.100
| stats dc(Relative_Target_Name)
總共是 257 個,則 257 為答案
ans : 257
Q31 : Ransomware: The Cerber ransomware encrypts files located in Bob Smith's Windows profile. How many .txt files does it encrypt?
這題問的是在 Bob Smith 的電腦上有多少的 .txt 檔被 ransomware 鎖起來了
首先我們先使用 Sysmon 將針對 Bob Smith 內的 .txt 的操作抓下來,並且看是哪個檔案對 .txt 操作
index=botsv1 source="wineventlog:microsoft-windows-sysmon/operational" TargetFilename="C:\\Users\\bob.smith.WAYNECORPINC\\*.txt"
| table Image TargetFilename
可以看到是有一個 osk.exe 對 .txt 檔做操作,
那我們可以 EventID=1 去看這個 osk.exe 的 hash
index=botsv1 source="wineventlog:microsoft-windows-sysmon/operational" EventCode=1 Image="C:\\Users\\bob.smith.WAYNECORPINC\\AppData\\Roaming\\{35ACA89F-933F-6A5D-2776-A3589FB99832}\\osk.exe"
得到的 MD5 hash 為 EE0828A4E4C195D97313BFC7D4B531F1,丟進給 VirusTotal 後
可以確定它是惡意程式
接下來針對這個 osk.exe 去計算所有 .txt 的數量
答案出來為 406,則 406 為這題的答案
ans : 406
Q32 : Ransomware: What was the first suspicious domain visited by we8105desk in 24AUG2016?
題目問 we8105desk 在 2016/08/24 時訪問了哪個可疑 domain?
我們在 Q26 中發現它會去向 solidaritedeproximite.org
請求 jpg 檔,而 solidaritedeproximite.org
則為這題的解答。
ans : solidaritedeproximite.org
今天把 Boss Of The SOC v1 最後幾題題目分享完了,今天也學到了更多 Threat Hunting 的技巧,這場 Boss Of The SOC v1 我覺得題目都出得很好,都可以學到非常多的東西,除了 v1 之外也有 v2、v3,歡迎大家可以挑戰。