LoginSignup
3

More than 3 years have passed since last update.

SECCON 2016 Online CTF Writeup - Memory Analysis

Last updated at Posted at 2016-12-11

Memory Analysis (Forensics, 100pts)

メモリダンプのデータが渡されるので、解析結果からWebサイトにアクセスせよ。との問題です。

解析ツールを入手

Hint1: http://www.volatilityfoundation.org/

出題ページのヒントを元に、Volatilityを導入しました。
メモリダンプ等を解析可能なフォレンジックツールです。サイトの「Releases」→「2.5」から辿って入手できます。

メモリダンプ解析

以下のサイトを参考に、各オプションを使用して解析を進めました。
「Volatility Frameworkを使ったメモリフォレンジック」と言うハンズオンに参加させて頂きました。 | Developers.IO

imageinfo でOS情報等を取得

$ vol.py -f forensic_100.raw imageinfo
Volatility Foundation Volatility Framework 2.5
INFO    : volatility.debug    : Determining profile based on KDBG search...
          Suggested Profile(s) : WinXPSP2x86, WinXPSP3x86 (Instantiated with WinXPSP2x86)
(後略)

pstree でプロセス一覧を取得

$ vol.py -f forensic_100.raw pstree
Volatility Foundation Volatility Framework 2.5
Name                                Pid   PPid   Thds   Hnds Time
--------------------------------- ------ ------ ------ ------ ----
 0x8231f698:explorer.exe           1556   1520     15    466 2016-12-06 05:27:10 UTC+0000
 0x823c8660:System                    4      0     58    259 1970-01-01 00:00:00 UTC+0000
. 0x81a18020:smss.exe               540      4      3     19 2016-12-06 05:27:04 UTC+0000
.. 0x82173da0:winlogon.exe          628    540     24    541 2016-12-06 05:27:07 UTC+0000
... 0x8216e670:services.exe         672    628     15    286 2016-12-06 05:27:07 UTC+0000
.... 0x81f65da0:svchost.exe        1776    672      2     23 2016-12-06 05:27:10 UTC+0000
..... 0x8225bda0:IEXPLORE.EXE       380   1776     22    385 2016-12-06 05:27:19 UTC+0000
...... 0x8229f7e8:IEXPLORE.EXE     1080    380     19    397 2016-12-06 05:27:21 UTC+0000

(一部略)

connections で通信の一覧を取得

$ vol.py -f forensic_100.raw connections
Volatility Foundation Volatility Framework 2.5
Offset(V)  Local Address             Remote Address            Pid
---------- ------------------------- ------------------------- ---
0x8213bbe8 192.168.88.131:1034       153.127.200.178:80        1080

Windows XP上で、153.127.200.178:80 にコネクションが張られています。
80番ポート=HTTP ですので、IEからWebサーバにアクセスしているようです。

Internet Explorerの履歴を取得

さらに調べていたところ、 iehistory でIEの履歴を取得できるようです。

$ vol.py -f forensic_100.raw iehistory
Volatility Foundation Volatility Framework 2.5
**************************************************
Process: 1080 IEXPLORE.EXE
Cache type "DEST" at 0x201ca83
Last modified: 2016-12-06 14:28:40 UTC+0000
Last accessed: 2016-12-06 05:28:42 UTC+0000
URL: SYSTEM@http://crattack.tistory.com/entry/Data-Science-import-pandas-as-pd
Title: Security & Reverse :: [Data Science] Pandas - \),

http://crattack.tistory.com/entry/Data-Science-import-pandas-as-pd にアクセスしてみたところ、ハングル文字の技術ブログが出てくるのみでflagらしき文字列は見当たりません。

hostsの取得

Hint2: Check the hosts file

ここでヒントを思い出し、hostsファイルを探すことにしました。
参考にしたサイト(PDF) : CheatSheet_v2.4.pdf の 3ページ 7段目

filescan でダンプ内のファイル一覧を取得し、grep hostsで絞り込みます。

$ vol.py -f forensic_100.raw filescan | grep hosts
Volatility Foundation Volatility Framework 2.5
0x000000000217b748      1      0 R--rw- \Device\HarddiskVolume1\WINDOWS\system32\drivers\etc\hosts

dumpfiles でファイルの内容を取得します。

$ vol.py -f forensic_100.raw dumpfiles -Q 0x000000000217b748 --name -D ./
Volatility Foundation Volatility Framework 2.5
DataSectionObject 0x0217b748   None   \Device\HarddiskVolume1\WINDOWS\system32\drivers\etc\hosts

カレントディレクトリに生成されたファイルを確認します。

$ cat file.None.0x819a3008.hosts.dat
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
153.127.200.178    crattack.tistory.com

再度Webサイトにアクセス

IE履歴から取得したURLにhostsのIPアドレスを当てはめると、
http://crattack.tistory.com/entry/Data-Science-import-pandas-as-pd のURLで、
http://153.127.200.178/entry/Data-Science-import-pandas-as-pd にアクセスしたことになります。

後者のURLを開いたところ、40バイトのファイルが得られました。

Data-Science-import-pandas-as-pd
    SECCON{_h3110_w3_h4ve_fun_w4rg4m3_}

無事、flagを獲得することができました。

種明かし(?)

後から気が付いたのですが、ホスト名をDNSで名前解決した場合は異なるIPアドレスが返ってくるようです。
ホスト名とIP直打ちでは、それぞれ異なるサーバに接続されていたのですね。

nslookupの応答
>nslookup crattack.tistory.com

権限のない回答:
名前:    crattack.tistory.com
Addresses:  175.126.170.70
          175.126.170.110
hostsの記載
153.127.200.178    crattack.tistory.com

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
What you can do with signing up
3