はじめに
本記事はTryHackMeのWriteupです。
RoomはMemory Forensics、Difficulty(難易度)はEasyです。
このRoomでは、Memory Forensicsについて学ぶことができます。ツールはVolatility 2を利用しています。
Volatility 2を使用する方法については、以前書いたVolatility 2の環境構築をご参照ください。
Login
Volatility 2で解析を行うためには、OSのプロファイルを指定する必要があります。
はじめにimageinfo
のプラグインを用いて、OSのプロファイルを確認します。
$ vol.py -f Snapshot6.vmem imageinfo
Volatility Foundation Volatility Framework 2.6.1
INFO : volatility.debug : Determining profile based on KDBG search...
Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_24000, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_24000, Win7SP1x64_23418
AS Layer1 : WindowsAMD64PagedMemory (Kernel AS)
AS Layer2 : FileAddressSpace (/home/kali/work/thm/memory_forensics/Snapshot6.vmem)
PAE type : No PAE
DTB : 0x187000L
KDBG : 0xf80002c4a0a0L
Number of Processors : 1
Image Type (Service Pack) : 1
KPCR for CPU 0 : 0xfffff80002c4bd00L
KUSER_SHARED_DATA : 0xfffff78000000000L
Image date and time : 2020-12-27 06:20:05 UTC+0000
Image local date and time : 2020-12-26 22:20:05 -0800
上記の出力結果を踏まえて、Win7SP1x64のプロファイルを指定します。また、WindowsのパスワードとなるNTLMハッシュを取得するためには、hashdump
のプラグインを用いてパスワードをダンプします。
$ vol.py -f Snapshot6.vmem --profile Win7SP1x64 hashdump
Volatility Foundation Volatility Framework 2.6.1
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
John:1001:aad3b435b51404eeaad3b435b51404ee:47fbd6536d7868c873d5ea455f2fc0c9:::
HomeGroupUser$:1002:aad3b435b51404eeaad3b435b51404ee:91c34c06b7988e216c3bfeb9530cabfb:::
ダンプして取得できたパスワードは、John the Ripperを使用して解析するため、NTLMハッシュの値をテキストファイルとして保存します。
$ echo "aad3b435b51404eeaad3b435b51404ee:47fbd6536d7868c873d5ea455f2fc0c9" > hash.txt
コマンドの引数は、Windowsのパスワードになるため、--format=nt
を指定して実行します。
$ john --format=nt --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (NT [MD4 256/256 AVX2 8x3])
Warning: no OpenMP support for this hash type, consider --fork=12
Press 'q' or Ctrl-C to abort, almost any other key for status
************* (aad3b435b51404eeaad3b435b51404ee)
1g 0:00:00:00 DONE (2024-03-30 22:24) 2.777g/s 25502Kp/s 25502Kc/s 25502KC/s charmed12b..charmaise
Use the "--show --format=NT" options to display all of the cracked passwords reliably
Session completed.
Analysis
シャットダウンされた時間を調査するためには、shutdowntime
のプラグインを利用します。
$ vol.py -f Snapshot19.vmem --profile Win7SP1x64 shutdowntime
Volatility Foundation Volatility Framework 2.6.1
Registry: SYSTEM
Key Path: ControlSet001\Control\Windows
Key Last updated: 2020-12-27 22:50:12 UTC+0000
Value Name: ShutdownTime
Value: 2020-12-27 22:50:12 UTC+0000
volatilityには以下の様なcmd.exeで実行されたコマンドの実行結果や履歴を取得できるプラグインがあります。
- cmdline:プロセスのコマンドライン引数を表示
- cmdscan:_COMMAND_HISTORYをスキャンしてコマンド履歴を抽出
コマンド履歴を確認するためには、cmdscan
のプラグインを利用します。
$ vol.py -f Snapshot19.vmem --profile Win7SP1x64 cmdscan
Volatility Foundation Volatility Framework 2.6.1
**************************************************
CommandProcess: conhost.exe Pid: 2488
CommandHistory: 0x21e9c0 Application: cmd.exe Flags: Allocated, Reset
CommandCount: 7 LastAdded: 6 LastDisplayed: 6
FirstCommand: 0 CommandCountMax: 50
ProcessHandle: 0x60
Cmd #0 @ 0x1fe3a0: cd /
Cmd #1 @ 0x1f78b0: echo THM{************} > test.txt
Cmd #2 @ 0x21dcf0: cls
Cmd #3 @ 0x1fe3c0: cd /Users
Cmd #4 @ 0x1fe3e0: cd /John
Cmd #5 @ 0x21db30: dir
Cmd #6 @ 0x1fe400: cd John
Cmd #15 @ 0x1e0158: "
Cmd #16 @ 0x21db30: dir
TrueCrypt
TrueCryptは、暗号化された仮想ディスクを作成・利用するソフトウエアです。
キャッシュされたパスフレーズを取得するためには、truecryptpassphrase
を利用します。
$ vol.py -f Snapshot14_1609164553061.vmem --profile Win7SP1x64 truecryptpassphrase
Volatility Foundation Volatility Framework 2.6.1
Found at 0xfffff8800512bee4 length 11: ***********
おわりに
この様な問題を解くためには、Volatility 3ではなくVolatility 2が便利です。