SANSからの練習問題を試す プロセスの確認 (3)
引き続きプロセスの状況を確認していきます、どこまでプロセスを確認してから次のステップに進めるべきかは難しいところですが、気になるプロセスは事前にまずリストアップしておく方が見逃しは減らせるのではないでしょうか。
RedLineでプロセス一覧を確認すると、PID 840としてcmd.exeが実行され、その子供プロセスとしてMIRAgent.exeが実行されている様子が表示されています。
MIRAgentはMandiantのツールですので、その呼び出しにCMDが使われたという事が推測できます。
とはいえ、CMD.EXE経由で実行された内容などがメモリに残っている部分があるはずですので、そちらの情報を念のため確認しておきたいと思います。
RedLineでは解析処理のオプション設定でStringsを指定することができます。Stringsをチェックしておくと、プロセス毎にStringsで文字列を確認することが可能です。PID 840のcmd.exeについて文字列を確認してみます。
Stringsはかなりの量がありますが、MIRAgent.exe関連の文字列を確認することもできます。
これとは別に、CMD関連ではcsrss.exeプロセスのStringsも確認する価値があるかもしれません。
csrss.exeのStringsを確認してみると、コマンドの引数などの文字列を確認することも出来そうですが、この結果を見ていくよりもVolatility Freameworkの専用コマンドを利用した方がより理解しやすい形で結果を確認できます。
Volatility 2.3 のプラグインとして、cmdscanとconsolesの二つのプラグインが提供されています。
https://code.google.com/p/volatility/wiki/CommandReference23#cmdscan
https://code.google.com/p/volatility/wiki/CommandReference23#consoles
特に、consolesプラグインではコマンドを実行した結果内容についてを解析して表示してきますので、どの様なコマンドを実行し、その結果として何が表示されたのかを(データがまだ残っていれば)追跡できる事になります。
csrss.exeについてですが、Volatility Wikiのcmdscanの項目で詳しく解説がされています。コンソールホストプロセスとしては、csrss.exe(XP)またはconhost.exe(Win7)が存在しており、これらのプロセスのデータを解析する事でコマンド履歴を表示する仕組みになっているようです。コマンド履歴のデフォルト値は50件ですが、cmdscanでは最後の追加、最後の表示、などの値も表示してくれます。
consolesコマンドは、コマンド履歴だけでなく、そのコマンドにより表示された内容も含めて表示してくれる所に大きな違いがあります。このイメージの出力結果よりも上記URLのサンプル出力結果を見る方が楽しめると思います。
それぞれのコマンドの実行結果を確認してみたいと思いますので、まずはcmdscanを実行してみます。(実行ファイル名を短くする為にvola.exeとしています)
c:\Cases\APT>vola.exe -f APT.img --profile=WinXPSP3x86 cmdscan
Volatility Foundation Volatility Framework 2.3.1
**************************************************
CommandProcess: csrss.exe Pid: 636
CommandHistory: 0x1007910 Application: MIRAgent.exe Flags: Allocated
CommandCount: 0 LastAdded: -1 LastDisplayed: -1
FirstCommand: 0 CommandCountMax: 50
ProcessHandle: 0x104
**************************************************
CommandProcess: csrss.exe Pid: 636
CommandHistory: 0x10132d8 Application: cmd.exe Flags: Allocated, Reset
CommandCount: 2 LastAdded: 1 LastDisplayed: 1
FirstCommand: 0 CommandCountMax: 50
ProcessHandle: 0x308
Cmd #0 @ 0x1013160: cd "c:\Program Files\Mandiant\Mandiant Intelligent ResponseAgent"
Cmd #1 @ 0x1007790: MIRAgent.exe -o -script MalwareAudit.Batch.xml -encoding none
次にconsolesを実行してみます。
**************************************************
ConsoleProcess: csrss.exe Pid: 636
Console: 0x4f2378 CommandHistorySize: 50
HistoryBufferCount: 2 HistoryBufferMax: 4
OriginalTitle: %SystemRoot%\system32\cmd.exe
Title: C:\WINDOWS\system32\cmd.exe - MIRAgent.exe -o -script MalwareAudit.Batch.xml -encoding none
AttachedProcess: MIRAgent.exe Pid: 456 Handle: 0x104
AttachedProcess: cmd.exe Pid: 840 Handle: 0x308
----
CommandHistory: 0x1007910 Application: MIRAgent.exe Flags: Allocated
CommandCount: 0 LastAdded: -1 LastDisplayed: -1
FirstCommand: 0 CommandCountMax: 50
ProcessHandle: 0x104
----
CommandHistory: 0x10132d8 Application: cmd.exe Flags: Allocated, Reset
CommandCount: 2 LastAdded: 1 LastDisplayed: 1
FirstCommand: 0 CommandCountMax: 50
ProcessHandle: 0x308
Cmd #0 at 0x1013160: cd "c:\Program Files\Mandiant\Mandiant Intelligent Response Agent"
Cmd #1 at 0x1007790: MIRAgent.exe -o -script MalwareAudit.Batch.xml -encoding none
----
Screen 0x4f2a80 X:80 Y:300
Dump:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\demo>cd "c:\Program Files\Mandiant\Mandiant Intelligen
t Response Agent"
C:\Program Files\Mandiant\Mandiant Intelligent Response Agent>MIRAgent.exe -o -s
cript MalwareAudit.Batch.xml -encoding none
MIR Agent 1.3.900
Running as: VICTIM1\demo
Audit Module: AccountAuditModule Version: 1.2.20.0
Audit Module: CommandAuditModule Version: 1.3.0.0
Audit Module: EventLogAuditModule Version: 1.2.16.0
Audit Module: FileAuditModule Version: 1.3.8.0
Audit Module: MemoryAuditModule Version: 1.3.5.0
Audit Module: PortAuditModule Version: 1.3.5.0
Audit Module: ProcessAuditModule Version: 1.2.16.0
Audit Module: RegistryAuditModule Version: 1.3.4.2
Audit Module: ServiceAuditModule Version: 1.2.6.0
Audit Module: SystemAuditModule Version: 1.2.15.0
Audit Module: TaskAuditModule Version: 1.3.3.0
Filter Module: XPathFilterModule Version: 1.3.0.0
Service Module: FilesystemServiceModule Version: 1.3.9.0
Service Module: SecuritySystemServiceModule Version: 1.2.20.0
MIR Agent 1.3.900 running as VICTIM1\demo
Loading the script from 'MalwareAudit.Batch.xml'.
Beginning local audit.
Audit started 05-05-2009 15:28:53
Checking if 'C:\Program Files\Mandiant\Mandiant Intelligent Response Agent\Audit
s\VICTIM1\20090505192855' exists...
Saving batch result to 'C:\Program Files\Mandiant\Mandiant Intelligent Response
Agent\Audits\VICTIM1\20090505192855\'.
Batch results written to 'C:\Program Files\Mandiant\Mandiant Intelligent Respons
e Agent\Audits\VICTIM1\20090505192855\'.
Name: mir.w32memory-acquisition.xml
Auditing (w32memory-acquisition) started 05-05-2009 15:28:55
<Issue number="0" level="Info" summary="Ignoring device address 0x00000000000a00
00 - 0x00000000000bffff" context="EnumerateDevices"/>
<Issue number="0" level="Info" summary="Ignoring device address 0x00000000200000
00 - 0x00000000febfffff" context="EnumerateDevices"/>
<Issue number="0" level="Info" summary="Ignoring device address 0x00000000000e00
00 - 0x00000000000e3fff" context="EnumerateDevices"/>
<Issue number="0" level="Info" summary="Ignoring device address 0x00000000000cc0
00 - 0x00000000000dbfff" context="EnumerateDevices"/>
さて、結果を確認してみると、やはりMIRAgent.exeの実行に関連したデータだけが得られ、それ以外に特に不審そうな項目は無さそうです。
更に追加で確認するとすれば、クリップボード内のデータという事になるかもしれませんが、こちらもVolatilityのプラグインとして提供されていますね。
https://code.google.com/p/volatility/wiki/CommandReferenceGui22#clipboard