はまやんはまやんはまやん

hamayanhamayan's blog

Hack The Box Sherlocks - ProcNet Writeup

https://app.hackthebox.com/sherlocks/ProcNet
Hack The Box Sherlocksとは

Sherlock Scenario

With the rising utilization of open-source C2 frameworks by threat actors, our red team has simulated the functionalities of one such widely employed framework. The objective of this exercise is to aid blue teams in strengthening their defenses against these specific threats. We have been provided with PCAP files and APIs collected during the event, which will serve as valuable resources. Let us now initiate the hunting process. Using the API Monitor: We are well-acquainted with opening PCAP and .EVTX files, but what are .apmx64 ? The .apmx64 file extension is associated with API Monitor, a software used to monitor and control API calls made by applications and services. To commence your analysis, follow the steps provided below: Download the API Monitor Navigate to "Files" and click on "Open" to view captured data from the file: "Employee.apmx64" or "DC01.apmx64" After opening the file, the "Monitoring Process" window will populate with a list of processes. Expand the view by clicking the '+' symbol to reveal the modules and threads associated with each process. The API calls can be observed in the "Summary" window. To focus our analysis on a specific module, click on the different DLLs loaded by the processes. TIP: When conducting analysis, it is advisable to begin by examining the API calls made by the process itself, rather than focusing solely on DLLs. For instance, if I intend to analyze the API calls of a process named csgo.exe, I will initially expand the view by clicking the '+' symbol. Then, I will narrow down my analysis specifically to 'csgo.exe' by selecting it, and I can further analyze other DLLs as needed.
脅威アクターによるオープンソース C2 フレームワークの利用が増加しているため、当社のレッド チームは、そのような広く使用されているフレームワークの 1 つの機能をシミュレートしました。この演習の目的は、青チームがこれらの特定の脅威に対する防御を強化できるように支援することです。イベント中に収集された貴重なリソースとなる PCAP ファイルと API を提供していただきました。では、狩猟プロセスを開始しましょう。API モニターの使用: PCAP および .EVTX ファイルを開くことはよく知っていますが、.apmx64 とは何ですか? .apmx64 ファイル拡張子は、アプリケーションやサービスによって行われる API 呼び出しを監視および制御するために使用されるソフトウェアである API Monitor に関連付けられています。分析を開始するには、以下の手順に従ってください。 API モニターをダウンロードします。 [ファイル] に移動し、[開く] をクリックして、ファイルからキャプチャされたデータを表示します: 「Employee.apmx64」または「DC01.apmx64」 ファイルを開いた後、 「プロセスの監視」ウィンドウにプロセスのリストが表示されます。「+」記号をクリックしてビューを展開すると、各プロセスに関連付けられたモジュールとスレッドが表示されます。API 呼び出しは「概要」ウィンドウで確認できます。特定のモジュールに焦点を当てて分析するには、プロセスによってロードされたさまざまな DLL をクリックします。ヒント: 分析を行うときは、DLL だけに焦点を当てるのではなく、プロセス自体によって行われる API 呼び出しを調べることから始めることをお勧めします。たとえば、csgo.exe という名前のプロセスの API 呼び出しを分析する場合は、最初に「+」記号をクリックしてビューを展開します。次に、「csgo.exe」を選択して分析対象を特に絞り込み、必要に応じて他の DLL をさらに分析できます。

一般PCとドメインコントローラーについて、

  • API Monitorによるクライアントログ
  • パケットキャプチャ
  • Sysmonのevtxファイル

が与えられて、設問に答えていく。

Tasks

Task 1

To which IP address and port number is the malware attempting to establish a connection ?
マルウェアはどの IP アドレスとポート番号に対して接続を確立しようとしていますか?

クライアント側のpcapファイルを眺めると3.6.165.8:443だった。

Task 2

Now that you are aware of the IP address and port number, what is the JA3 fingerprint of the C2 server ?
IP アドレスとポート番号はわかったので、C2 サーバーの JA3 フィンガープリントは何でしょうか?

WireSharkプラグインを探すと便利そうなものがあった。

fullylegit/ja3: A wireshark/tshark plugin for the JA3 TLS Client Fingerprinting Algorithm

ip.addr == 3.6.165.8 && tcp.port == 443でフィルタリングして出てきたNo.18487でJA3フィンガープリントを取得できる。19e29534fd49dd27d09234e639c4057e

Task 3

What is the name of the C2 framework being utilized by the red team ?
レッドチームが使用している C2 フレームワークの名前は何ですか?

Task 2のJA3フィンガープリントで検索すると以下サイトが見つかり、Silverであることが分かる。

https://www.bilibili.com/read/cv19510951/

Task 4

Which WIN32 API provided the red team with the current directory information ?
どの WIN32 API がレッド チームに現在のディレクトリ情報を提供しましたか?

API Monitorでcsgo.exeでの呼び出しを眺めるとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
8   4:31:34.820 PM  2   csgo.exe    GetCurrentDirectoryW ( 300, 0x000000c0001b7c88 )    31      0.0000031

Task 5

Now that we have identified the C2 framework utilized by the red team, which C2 command is responsible for opening notepad.exe by default and loading the .NET CLR into it ?
レッド チームが利用している C2 フレームワークが特定できたので、デフォルトで notepad.exe を開いて .NET CLR をロードするのはどの C2 コマンドですか?

silver c2あたりで検索してそれっぽいものを探す。ここを見るとexecute-assemblyだった。

Task 6

What is the name of the module (DLL) that was loaded to gain access to Windows Vault ?
Windows Vault にアクセスするためにロードされたモジュール (DLL) の名前は何ですか?

Task 5からnotepad.exeを見ればいいことは分かっているので、API Monitorでnotepad.exeでの呼び出しを眺めるとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
26913   4:34:00.866 PM  1   clr.dll LoadLibraryExW ( "vaultcli.dll", NULL, 0 )  0x00007fff16860000      0.0036025

Task 7

After loading the mentioned module, there were a series of WIN32 APIs loaded. Which specific Win32 API is responsible for enumerating vaults ?
前述のモジュールをロードした後、一連の WIN32 API がロードされました。ボールトの列挙を担当する特定の Win32 API はどれですか?

API Monitorでnotepad.exeでの呼び出しを眺めるとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
#   Time of Day Thread  Module  API Return Value    Error   Duration
26559   4:34:00.834 PM  1   clr.dll WideCharToMultiByte ( CP_UTF8, 0, "VaultEnumerateVaults", -1, NULL, 0, NULL, NULL ) 21      0.0000003

27267   4:34:00.898 PM  1   clr.dll GetProcAddress ( 0x00007fff16860000, "VaultOpenVault" ) 0x00007fff168638f0      0.0000030
27268   4:34:00.898 PM  1   clr.dll GetProcAddress ( 0x00007fff16860000, "VaultOpenVaultW" )    NULL    127 = 指定されたプロシージャが見つかりません。  0.0000023

27449   4:34:00.913 PM  1   clr.dll GetProcAddress ( 0x00007fff16860000, "VaultEnumerateItems" )    0x00007fff16862820      0.0000023
27450   4:34:00.913 PM  1   clr.dll GetProcAddress ( 0x00007fff16860000, "VaultEnumerateItemsW" )   NULL    127 = 指定されたプロシージャが見つかりません。  0.0000020

Task 8

Which command did the attacker execute to identify domain admins ?
攻撃者はドメイン管理者を特定するためにどのコマンドを実行しましたか?

API Monitorでcsgo.exeでの呼び出しを眺めるとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
1632    4:41:11.197 PM  4   csgo.exe    CreateProcessW ( "C:\WINDOWS\system32\net.exe", "net group "domain admins" /dom", NULL, NULL, TRUE, CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT, 0x000000c0001c2000, NULL, 0x000000c00009b9f8, 0x000000c00009b8d8 )   TRUE        0.0113765

Task 9

The red team has provided us with a hint that they utilized one of the tools from "ARMORY" for lateral movement to DC01. What is the name of the tool ?
レッドチームは、DC01 への横方向の移動に「ARMORY」のツールの 1 つを利用したというヒントを提供してくれました。ツールの名前は何ですか?

armoryのレポジトリを眺めてそれっぽいものを提出した。

https://github.com/orgs/sliverarmory/repositories

SharpWMIだった。

Task 10

Which command was executed by the red team to extract/dump the contents of NTDS.DIT ?
NTDS.DIT​​ の内容を抽出/ダンプするためにレッド チームによって実行されたコマンドはどれですか?

DCのAPI MonitorでPID:7332で適当に探すとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
205 4:55:26.539 PM  1   cmd.exe wcschr ( "cmd /c ntdsutil "ac in ntds" ifm "cr fu %TEMP%\H00i0Z000.dat" q q", '/' ) 0x00007ff7afe92818      0.0000031

Task 11

The red team has obtained the aforementioned dump by compressing it into a ZIP file. Which specific Win32 API is responsible for retrieving the full path of the file to be downloaded?
レッド チームは、ZIP ファイルに圧縮して前述のダンプを取得しました。ダウンロードするファイルの完全パスを取得する役割を担うのは、どの Win32 API ですか?

DCのAPI MonitorでPID:1132で適当に探すとある。

#    Time of Day Thread  Module  API Return Value    Error   Duration
11515   5:04:27.591 PM  5   fifa24.exe  GetFullPathNameW ( "ntds.zip", 100, 0x000000c000076000, NULL )  38      0.0000065