LoginSignup
1
1

More than 3 years have passed since last update.

Splunk Boss of the SOCについて(その3 Installation)

Last updated at Posted at 2019-09-16

Boss of the SOC (BOTS) Investigation Workshop for Splunkのbotv1を使用してScenario #1_APTを順繰りやっていく3回目。

サイバーキルチェーンはここを参照。
前前回が偵察(reconnaissance)で、前回が攻撃(exploitation)、今回が設置(Installation)

Identifying the Executable Uploaded

What is the name of the executable uploaded by P01s0n1vy?
P01s0n1vyによってアップロードされた実行可能ファイルの名前は何ですか?

A clue in the question indicates that the name of the file was an executable. We could take that literally and search for .exe if we want. When conducting an investigation, that might be too narrow of criteria, but in this case, we can go down that route. If we look at the data sources we have, Suricata can be an appealing place to start because it generates events based on rules pertaining to files it sees. We also know that because the adversary was uploading to our web server, stream:http may be useful as well.
質問の手がかりは、ファイルの名前が実行可能ファイルであることを示しています。必要に応じて、それをそのまま取得し、.exeを検索できます。調査を実施する場合、基準が狭すぎる可能性がありますが、この場合、そのルートをたどることができます。持っているデータソースを見ると、Suricataは見ているファイルに関連するルールに基づいてイベントを生成するので、魅力的な出発点になります。また、攻撃者がWebサーバーにアップロードしていたため、stream:httpも役立つことがあります。

Search for EXEs in stream:http AND suricata

SPL
index=botsv1 (sourcetype=stream:http OR sourcetype=suricata) dest_ip="192.168.250.70" *.exe
| search fileinfo.filename=* OR part_filename{}=*

Appsでは個別にやっているけど、dest_ipは双方共通なので一気に検索。
qiita4.png
qiita5.png
Appsだとフィールドの違いによって一括して調べる方法をいろいろやっているけど、困ったら

SPL
index=botsv1 (sourcetype=stream:http OR sourcetype=suricata) "192.168.250.70" *.exe POST
| search fileinfo.filename=* OR part_filename{}=*

とあえてフィールド名を指定せずにサーチすればいいと思う。
この結果から3791.exeを使用していけないことをやっていることがわかる。

Determining the Hash of the Uploaded File

これから、Sysmonのログを検索していく。ハッシュ値でてるんだ。

As we inspect the interesting fields in Sysmon, we can see event descriptions that include image load, process create, network connect, all of which can give us insight into things happening on a specific Windows system, not only from a program execution perspective, but also from a network communication perspective. We can also see hashes for files that include MD5, SHA1 and SHA256.
Sysmonの興味深いフィールドを調べると、イメージの読み込み、プロセスの作成、ネットワーク接続などのイベントの説明を見ることができます。これらはすべて、プログラム実行の観点からだけでなく、特定のWindowsシステムで起こっていることに関する洞察を与えてくれます。ネットワーク通信の観点からも。 MD5、SHA1、SHA256を含むファイルのハッシュも確認できます。

ここでAdd-on for Microsoft Sysmonがはいっていないことに気づいたので、インストール。:sweat:

全部が綺麗にでた。
いちおうログを確かめようと

SPL
index=botsv1 3791.exe sourcetype=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational 
| search ParentCommandLine=*
| sort _time

で見てみる。
一番最初のログのParentCommandLineフィールドが

cmd.exe /c "3791.exe 2>&1"

cmd.exe /c "3791.exe 2>&1"ということで、3791.exeを実行するけどエラーもなにも画面に出さないというコマンドが走ったことがわかる。

SPL
index=botsv1 3791.exe sourcetype=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational 
| search ParentCommandLine=*
| sort _time
| table _time cmdline CurrentDirectory ParentCommandLine

qiita6.png
Splunkの時系列だとごっちゃになってしまているけど、Command Injectionをやられたことがわかる。

Appsでは

If there are different versions of executables compiled, you can certainly have different hashes for those files. If we are looking for something more insidious like a malicious file called explorer.exe we could get a number of md5 hits, but using values allows us to get a single list of all hashes to then work with. Whitelisting could be used to isolate the known good hashes from the rest.
実行可能ファイルの異なるバージョンがコンパイルされている場合、それらのファイルに対して異なるハッシュを使用できます。 explorer.exeと呼ばれる悪意のあるファイルのようなもっと潜行性のあるものを探している場合、多数のmd5ヒットを取得できますが、値を使用すると、すべてのハッシュの単一リストを取得して処理できます。ホワイトリストを使用して、既知の良好なハッシュを残りから分離できます。

と書いてるけど、statsvaluesは複数の値の時はマルチバリューなのでそのままだと、lookupに引っ掛けることはできない。mvexpandを使用してから、lookupで引っ掛けるとかしないと。

installationはここまで。長くなったのでおしまいとします。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1