CyberDefender - Szechuan Sauce (Part 1)
Challenge: https://cyberdefenders.org/blueteam-ctf-challenges/31 Part 2: https://hackmd.io/@SBK6401/HkAbt-NXT :::spoiler TOC [TOC] :::
Scenario
An employee at a large company was assigned a task with a two-day deadline. Realizing that he could not complete the task in that timeframe, he sought help from someone else. After one day, he received a notification from that person who informed him that he had managed to finish the assignment and sent it to the employee as a test. However, the person also sent a message to the employee stating that if he wanted the completed assignment, he would have to pay $160.
The helper’s demand for payment revealed that he was actually a threat actor. The company’s digital forensics team was called in to investigate and identify the attacker, determine the extent of the attack, and assess potential data breaches. The team must analyze the employee’s computer and communication logs to prevent similar attacks in the future.
Tools
- volatility2
- FTK
- Timeline Explorer
- Wireshark
- Registry Explorer
前提
這一題有分兩個裝置,一個是Desktop,另外一個是server,也分別對這兩個進行FTK packet和export memory,所以在分析的時候要特別注意,以下問題的順序會在這兩個裝置之間切換
==Q1==
What’s the Operating System version of the Server? (two words)
Recon
這一題是針對server,所以可以直接用volatility對server memory進行分析,或者是直接用FTK對register進行稽核 起手式
1 |
|
:::spoiler Flag
Flag: 2012 R2
:::
==Q2==
What’s the Operating System of the Desktop? (four words separated by spaces)
Recon
這一題可以參考Hunter - Part 1 - Q5,我可以直接把Software的registry export出來,然後用registry explorer查看/root/Microsoft/Windows NT/CurrentVersion
就會知道==Desktop==的OS
Exploit
:::spoiler Flag
Flag: Windows 10 Enterprise Evaluation
:::
==Q3==
What was the IP address assigned to the domain controller?
Recon
Exploit
就是察看Server的SYSTEM中,ControlSet001/Services/Tcpip/Parameters/Interfaces/
:::spoiler Flag
Flag: 10.42.85.10
:::
==Q4==
What was the timezone of the Server?
Recon
可以先參考Hunter Part 1 - Q6
Exploit
這一題很迷,先查看Server的SYSTEM的ControlSet001/Control/TimeZoneInformation/
的TimeZoneKeyName是Pacific Standard Time,代表不是UTC-8就是UTC-7,但這兩個都不是答案,隨便try了以後再看hint發現,原來是Admin設定錯時區,要發現這一件事情真的很難,看了1還是一知半解,不過我試著自己操作和解釋
-
首先,根據hint的說明,可以知道domain controller的timezone和應該是和desktop不一樣所以才會有這樣的問題 這件事情可以從NTP(Network Time Protocol)看到,這主要是用於同步時間的protocol,所以從這些封包中可以看到他的時間是無法同步的,由此可知時間的timezone可能有問題
網路時間協定(英語:Network Time Protocol,縮寫:NTP)是在資料網路潛伏時間可變的電腦系統之間通過封包交換進行時鐘同步的一個網路協定,位於OSI模型的應用層。自1985年以來,NTP是目前仍在使用的最古老的網際網路協定之一。NTP由德拉瓦大學的David L. Mills設計。
-
具體來說到底差多少呢?這個可以從Server的event log和封包的時間差換算,我的想法是先把sercurity event log 從server export出來,然後找到RDP的登入時間,再比對wireshark的封包比對相對的時間就可以知道正確差多少
- Event Log在
/root/Windows/System32/winevt/Logs/
中,轉換成csv檔後再用timeline explorer打開1
$ ./EvtxECmd.exe -f Security.evtx --csv output
- 找到一樣的封包和event紀錄
可以看到event log的時間是
2020-09-19 03:21:48
,而封包的時間是2020-09-19 02:21:47
,兩者大約差了一個小時,因為當時的月份是9月也就是還在夏令時間,所以正確的時間應該是UTC-7,也就是說封包的時間是UTC-7的結果,而server上的3點是快了一小時的結果,所以應該是UTC-6就是server上設定的時間
- Event Log在
:::spoiler Flag
Flag: UTC-6
:::
==Q5==
What was the initial entry vector (how did they get in)?. Provide protocol name.
Recon
從上一題就可以知道他是利用RDP連到domain controller
:::spoiler Flag
Flag: RDP
:::
==Q6==
What was the malicious process used by the malware? (one word)
Recon
這一題提到malware馬上就要想到
- 他怎麼傳送過去到受害主機$\to$wireshark$\to$Export Object
- 如果他有跑起來,可不可以直接知道是哪一支檔案$\to$memory analysis$\to$volatility$\to$pslist
- 如果可以dump出來就送到virustotal看
Exploit
- 首先我先用volatility看他執行process的狀況
:::spoiler Result
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82$ ./volatility_2.6_win64_standalone.exe -f citadeldc01.mem --profile Win2012R2x64 pslist Volatility Foundation Volatility Framework 2.6 Offset(V) Name PID PPID Thds Hnds Sess Wow64 Start Exit ------------------ -------------------- ------ ------ ------ -------- ------ ------ ------------------------------ ------------------------------ 0xffffe0005f273040 System 4 0 98 0 ------ 0 2020-09-19 01:22:38 UTC+0000 0xffffe00060354900 smss.exe 204 4 2 0 ------ 0 2020-09-19 01:22:38 UTC+0000 0xffffe000602c2080 csrss.exe 324 316 8 0 0 0 2020-09-19 01:22:39 UTC+0000 0xffffe000602cc900 wininit.exe 404 316 1 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe000602c1900 csrss.exe 412 396 10 0 1 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060c11080 services.exe 452 404 5 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060c0e080 lsass.exe 460 404 31 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060c2a080 winlogon.exe 492 396 4 0 1 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060c84900 svchost.exe 640 452 8 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060c9a700 svchost.exe 684 452 6 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060ca3900 svchost.exe 800 452 12 0 0 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060d09680 dwm.exe 808 492 7 0 1 0 2020-09-19 01:22:40 UTC+0000 0xffffe00060d1e080 svchost.exe 848 452 39 0 0 0 2020-09-19 01:22:41 UTC+0000 0xffffe00060d5d500 svchost.exe 928 452 16 0 0 0 2020-09-19 01:22:41 UTC+0000 0xffffe00060da2080 svchost.exe 1000 452 18 0 0 0 2020-09-19 01:22:41 UTC+0000 0xffffe00060e09900 svchost.exe 668 452 16 0 0 0 2020-09-19 01:22:41 UTC+0000 0xffffe00060f73900 Microsoft.Acti 1292 452 9 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00060fe1900 dfsrs.exe 1332 452 16 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00060ff3080 dns.exe 1368 452 16 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00060ff7900 ismserv.exe 1392 452 6 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe000614aa200 VGAuthService. 1556 452 2 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00061a30900 vmtoolsd.exe 1600 452 9 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00061a9a800 wlms.exe 1644 452 2 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe00061a9b2c0 dfssvc.exe 1660 452 11 0 0 0 2020-09-19 01:22:57 UTC+0000 0xffffe0006291b7c0 svchost.exe 1956 452 30 0 0 0 2020-09-19 01:23:20 UTC+0000 0xffffe000629b3080 vds.exe 796 452 11 0 0 0 2020-09-19 01:23:20 UTC+0000 0xffffe000629926c0 svchost.exe 1236 452 8 0 0 0 2020-09-19 01:23:21 UTC+0000 0xffffe000629de900 WmiPrvSE.exe 2056 640 11 0 0 0 2020-09-19 01:23:21 UTC+0000 0xffffe00062a26900 dllhost.exe 2216 452 10 0 0 0 2020-09-19 01:23:21 UTC+0000 0xffffe00062a2a900 msdtc.exe 2460 452 9 0 0 0 2020-09-19 01:23:21 UTC+0000 0xffffe000631cb900 spoolsv.exe 3724 452 13 0 0 0 2020-09-19 03:29:40 UTC+0000 0xffffe00062fe7700 coreupdater.ex 3644 2244 0 -------- 2 0 2020-09-19 03:56:37 UTC+0000 2020-09-19 03:56:52 UTC+0000 0xffffe00062f04900 taskhostex.exe 3796 848 7 0 1 0 2020-09-19 04:36:03 UTC+0000 0xffffe00063171900 explorer.exe 3472 3960 39 0 1 0 2020-09-19 04:36:03 UTC+0000 0xffffe00060ce2080 ServerManager. 400 1904 10 0 1 0 2020-09-19 04:36:03 UTC+0000 0xffffe00063299280 vm3dservice.ex 3260 3472 1 0 1 0 2020-09-19 04:36:14 UTC+0000 0xffffe00062ede1c0 vmtoolsd.exe 2608 3472 8 0 1 0 2020-09-19 04:36:14 UTC+0000 0xffffe00063021900 FTK Imager.exe 2840 3472 9 0 1 0 2020-09-19 04:37:04 UTC+0000 0xffffe0006313f900 WMIADAP.exe 3056 848 5 0 0 0 2020-09-19 04:37:42 UTC+0000 0xffffe00062c0a900 WmiPrvSE.exe 2764 640 6 0 0 0 2020-09-19 04:37:42 UTC+0000
::: 當然有幾個我是有一點懷疑,例如
WmiPrvSE.exe
,WMIADAP.exe
,spoolsv.exe
等等,不過查了一下應該都是windows裡面內建的正常程序,不過也不能掉以輕心,可能是被駭客換過只是名字一樣,不過有一個process令人擔心,就是==coreupdater.exe==,因為查資料的時候無意間看到這個網站,裡面有提到詳細這支程式的攻擊手法和IP位置,因此感覺不是巧合,先dump出來再說 - 我是用volatility procdump,但是遇到一些問題導致dump不出來,可能是和paging有關係,導致PEB結構parse不出來
1
2
3
4
5$ ./volatility_2.6_win64_standalone.exe -f citadeldc01.mem --profile Win2012R2x64 procdump -p 3644 --dump-dir="Export Files/Server" Volatility Foundation Volatility Framework 2.6 Process(V) ImageBase Name Result ------------------ ------------------ -------------------- ------ 0xffffe00062fe7700 ------------------ coreupdater.ex Error: PEB at 0x7ff5ffffe000 is unavailable (possibly due to paging)
這邊有簡單說明甚麼是PEB [edu-ctf 2023] week06 - rev2
- 所以我們就要想有甚麼其他方法可以把這個file export出來,可以從他怎麼傳進server開始切入,如果從wireshark的export file可以dump出來
- 丟到virustotal果然很有問題
完整分析結果
:::spoiler Flag
Flag: coreupdater
:::
==Q7==
Which process did malware migrate to after the initial compromise? (one word)
Recon
這一題的直覺是利用volatility的malfind看有沒有利用coreupdater去inject哪一些process
Exploit
從結果可以看到有幾個process有問題:
Process: Microsoft.Acti Pid: 1292 Address: 0x10500120000
Process: svchost.exe Pid: 1236 Address: 0x1b10ee0000
Process: spoolsv.exe Pid: 3724 Address: 0x4afbf20000
Process: explorer.exe Pid: 3472 Address: 0x5770000
Process: ServerManager. Pid: 400 Address: 0x5dc9ce0000
:::spoiler Result
1 |
|
:::
:::spoiler Flag
Flag: spoolsv
:::
==Q8==
Identify the IP Address that delivered the payload.
Recon
直覺會想要volatility的netscan,但是結果實在是太多了,後來轉念一想直接看封包不就好了,所以我直接看原本傳送coreupdater.exe
到server的IP
Exploit
:::spoiler Flag
Flag: 194.61.24.102
:::
==Q9==
What IP Address was the malware calling to?
Recon
直覺就是volatility netscan再grep
Exploit
1 |
|
:::spoiler Flag
Flag: 203.78.103.109
:::
==Q10==
Where did the malware reside on the disk?
Recon
這一題直覺會在FTK上找,不過仔細想想可以直接volatility filescan再grep還比較快
Exploit
1 |
|
:::spoiler Flag
Flag: C:\Windows\System32\coreupdater.exe
:::