はじめに
本記事は CyberDefenders(以下リンク参考)の「SpottedInTheWild Lab」にチャレンジした際のWalkthroughになります
※本チャレンジについてはRed側のペネトレというよりはBlue側の分析力を問われるものになります。
※今回のチャレンジはディスクフォレンジックメインでしたね。
チャレンジ開始前
問題について
以下の画像の「Download Lab Files」に問題ファイルのリンクがあります。
アーカイブファイルで圧縮されているので仮想環境で解凍してください。
※ホストで解凍しないでください。ディスクイメージの中には本物のマルウェアが入ってたりします。
環境
この CyberDefenders を解く際には仮想環境でマルウェア解析やメモリフォレンジックを行う環境を用意する必要があります。
今回は以下のような環境を用意しました。
- remnux
- Windows 10
今回はWindows 10の環境を利用しました。
Autopsy
を基本的に使ってディスクフォレンジックを進めます。
Q1
In your investigation into the FinTrust Bank breach, you found an application that was the entry point for the attack. Which application was used to download the malicious file?
ディスクイメージをAutopsyに食わせて、とりあえずRecent Documents
を見てみます。
怪しい某Tのアプリがありますね!
Q2
Finding out when the attack started is critical. What is the UTC timestamp for when the suspicious file was first downloaded?
2024-02-02
以降のタイムラインを追います。タイムラインは以下のアイコンから確認できます。
雑にFile Createのeventを追います。Telegram経由で落としてきている怪しいアーカイブがありますね。
Q3
Knowing which vulnerability was exploited is key to improving security. What is the CVE identifier of the vulnerability used in this attack?
先ほど見つけたファイルをダウンロードします。
その後、certutil --hashfile
でハッシュ値を求めます。
このハッシュ値をVirusTotalで検索します。
このマルウェアが利用しているであろう脆弱性が分かります。
Q4
In examining the downloaded archive, you noticed a file in with an odd extension indicating it might be malicious. What is the name of this file?
上記のファイルをstrings.exe
にかけます。
.cmd
のファイルがあるようです。
Q5
Autopsyで.cmd
のファイルを検索します。
見えにくいですが、しっかり追っていくとC2のアドレスが見えます。
更なる調査
上記.cmd
ファイルの中には.ps1
や.bat
ファイルの記載が見えます。
というわけで、ついでにAutopsyで.bat
や.ps1
ファイルを追っていきます。
まずは.bat
ファイル
.ps1
ファイルが見える。タイムラインでこの.ps1
を追います。
フィルタをうまく利用します。
Base64とReverseを利用しているのがコードから判断できるので、Cybercefを利用します。
ぱっとコードを読んだ感じ、ラテラルムーブメントの足掛かりのためのホストを列挙しているように見える。
BL4356.txt
に保存しているようなので、このファイルを探してみる。
列挙してそうですね。
Q6
To further understand how attackers cover their tracks, identify the script they used to tamper with the event logs. What is the script name?
更なる調査
で見えてますね。そのままのファイル名です。
Q7
Knowing when unauthorized actions happened helps in understanding the attack. What is the UTC timestamp for when the script that tampered with event logs was run?
AutopsyのRun Programs
でPOWERSHELL.EXE
を動かしているタイムスタンプを投入してもうまくいきませんでした。
そこでEventlogを探ってみます。Eventlogを改ざんするプログラムなのであまりディスクの中のファイルを追いたくなかったのですが、これしかもうなさそうなので。
Windows Powershell.evtx
のEventlogファイルが見えます。
これを抽出しHayabusa
にかけます。とりあえず全部のルールに引っかけます。
中身を確認するとEventlogを改ざんするps1
はでてきてなさそうです。
なら直接見ます。
だいぶ少なかったので最初に直接見れば良かったです。
といっても、実際には大量にログがある場合もあるのでHayabusaを最初に回して絞ってみることをお勧めします。(ログの種類によってはFullのルールで回すよりはCriticalなルールで見るほうがいいです。)
Q8
We need to identify if the attacker maintained access to the machine. What is the command used by the attacker for persistence?
.cmd
ファイルを確認します。
Tasks
という文字が見えますね。Persistence
はタスクスケジューラだと当たりが付くかなと思います。
といってもここら辺のコマンドをAutopsyから拾えなかったので別のアプローチをとります。
.cmd
ファイルを抽出し、certutil -hashfile
からハッシュ値を取ります。
これをVirusTotalに突っ込み、Behaviorを確認します。
schtasks.exe
を起動するProcessとかが見当たらなかったのでAnyrun
も確認します。
コマンドラインを拾えました!
Q9
To understand the attacker's data exfiltration strategy, we need to locate where they stored their harvested data. What is the full path of the file storing the data collected by one of the attacker's tools in preparation for data exfiltration?
更なる調査
で分かってしまった。
最後に
Autopsy
を利用しまくるいい問題でした。
Threat Intel観点で無理矢理解いたような形の問題もありましたが、大体先人のつよつよマルウェアアナリストさんがIntelを抽出してくれてたりするので助かってます。