Shi0shishi0

汐鹿生

Defcon DFIR CTF 2018 Writeup(HR Server + File Server)

モチベーションとか

今年の8月頃, Defcon DFIR CTF 2018 が一般公開されたという記事をThis Week In 4n6で見て, とりあえずイメージファイルだけDLしてそのまま忘れていた.

thisweekin4n6.com

10月に大和セキュリティさんが開催した「DFIR忍者チャレンジ」に参加して, もっとForensicsの勉強をしたいというお気持ちになり, このCTFのことを思い…出したのでやってみた. 暇を見つけつつのんびりやったので, 最初の方と最後の方で使っている環境やツールが違ってたりするけど気にしないで欲しい.

DFIR忍者チャレンジは凄く勉強になりました.

yamatosecurity.connpass.com

以下のページにCTFサイトのURLと, イメージファイルのダウンロードリンクが貼られている.

www.hecfblog.com

イメージファイルは3つあり, それぞれ"HR Server" "File Server" "Desktop"の問題に対応していると思う.

一定数以上問題を解くと次のイメージファイルの解凍パスワードが提示される.

やっていく順番は HR Server -> File Server -> Desktop の順. 分からない問題は飛ばした.

下準備

主なログの取得を先にまとめてやっておいた.

パーサーはRegRipper, USN Analytics, analyzeMFT.pyあたりを使った.

イメージファイルの調査はFTK ImagerとArsenalImageMounterを使った.

HR Server - Basic

HR Server - Acquisition Software

Which software was used to image the HR Server?

HRServer_Disk0.txtを確認する.

使用されている解析ツールの名前はX-Ways Forensics.

08/08/2018, 14:32:43
X-Ways Forensics BYOD 19.6 SR-6 x64
Create Disk Image

FLAG : X-Ways Forensics

HR Server - Acquisition Software Version

Which version of the software was used to image the HR Server? [Format: n.n]

HRServer_Disk0.txtを確認する.

X-Waysのバージョンは19.6である.

08/08/2018, 14:32:43
X-Ways Forensics BYOD 19.6 SR-6 x64
Create Disk Image

FLAG : 19.6

HR Server - Entry Name

What is the file name that represents MFT Entry 168043?

$MFTは複数のエントリーによって構成されており、そのエントリには$SIや$FNなどの情報が含まれている.

f:id:echoha610:20181118223238p:plain

(Forensicist - MFT アーティファクト http://www.kazamiya.net/fte/MFT より)

MFT Entry 168043というのは言葉の通り, $MFTのエントリーを示すIDのことだと思われる.

$MFTをParseした結果に対して"168043"でgrepする.

"168043","Good","Active","File","1","167052","1","/Python37/Scripts/pip3.7.exe","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.458954","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.458954","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","","","","","PIP37~1.EXE","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","2018-07-23 13:39:41.412153","","","","","","","","","","","True","False","True","False","False","False","False","False","False","False","False","False","False","False","False","","N","N","N","N","N"

FLAG : pip3.7.exe

HR Server - Entry Number

What is the MFT Entry number of the following file? \xampp\mysql\bin\mysql.exe [format is an integer]

さっきの問題の逆.

mysql.exe の$MFTファイルのエントリーIDを確認する.

$MFTをParseした結果に対してmysql.exeでgrepしてみる.

"115322","Good","Active","File","7","115262","7","/xampp/mysql/bin/mysql.exe","2018-07-11 17:49:14.318705","2018-03-26 15:12:20","2018-07-11 17:49:14","2018-07-11 17:49:14.537365","2018-07-11 17:49:14.318705","2018-07-11 17:49:14.318705","2018-07-11 17:49:14.318705","2018-07-11 17:49:14.318705","","","","","","","","","","","","","","","","","","","","True","False","True","False","False","False","False","False","False","False","False","False","False","False","False","","N","N","N","N","N"

FLAG : 115322

HR Server - Attribute ID

What is the MFT Attribute ID of the named $J data attribute for the MFT Entry with a file name of $UsnJrnl?

分からなかったので飛ばした.

HR Server - SMB

At 2018-08-08 18:10:38.554 (UTC) what was the IP address of the the client that attempted to access SMB via an anonymous logon?

イベントログからSMBのアクセス情報を確認する.

FTK Imagerで %SystemRoot%\System32\winevt\Logs 配下にある Microsoft-Windows-SMBServer%4Security.evtx を抽出する.

JSTで表示されているので, 問われている時間に+9時間して 2018/08/09/03:10:38 で探したところ, 以下のログが見つかった.

SMB セッション認証失敗

クライアント名: \\80.81.110.50
クライアント アドレス: 80.81.110.50:8577
ユーザー名: ANONYMOUS LOGON
セッション ID: 0x0
状態: {アクセス拒否}
プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xC0000022)
SPN: session setup failed before the SPN could be queried
SPN 検証ポリシー: SPN optional / no validation

ガイダンス:

このエラーは、正しくない資格情報を使用して共有に接続しようとしたときに発生します。

このエラーは、必ずしも認証の問題を示すものではなく、多くの場合は権限の承認の問題です。より一般的には、Windows 以外のクライアントで発生する傾向があります。

このエラーは、NTLM で間違ったユーザー名とパスワードを使用した場合、クライアントとサーバーとの間で LmCompatibility 設定が一致していない場合、サービス プリンシパル名が間違っている場合、Kerberos サービス プリンシパル名が重複している場合、Kerberos チケット保証サービスのチケットが正しくない場合、またはゲスト アクセスを有効にせずに Guest アカウントを使用した場合に発生することがあります

FLAG : 80.81.110.50

HR Server - Saved

What was the name of the batch file saved by mpowers?

[answer is fullpath starting with c:*****]

MFTのParse結果からbatファイルをgrepしたところ, 1ファイル見つかった.

"166116","Good","Active","File","4","165091","2","/Production/update_app.bat","2018-07-23 16:15:06.786299","2018-07-23 17:35:35.379120","2018-07-23 16:15:06.786299","2018-07-23 17:35:35.379120","2018-07-23 16:15:06.786299","2018-07-23 16:15:57.911156","2018-07-23 16:15:06.786299","2018-07-23 16:15:57.911156","bbf1db24-8563-11e8-b7f3-acd82990ee82","00000080-00c8-0000-0000-180000000d00","000000a9-0018-0000-636f-7079205a3a5c","6a6f7270-6365-5f74-3078-30325c74636f","update_app.bat","2018-07-23 16:15:06.786299","2018-07-23 16:15:57.911156","2018-07-23 16:15:06.786299","2018-07-23 16:15:57.911156","","","","","","","","","","","True","False","True","True","False","False","False","False","False","False","False","False","False","False","False","","N","N","N","N","N"

一応ユーザの動作も追いたいので, NTUSER.DATをParseした結果の方も確認する.

comdlg32 v.20180702

Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32
LastWrite Time Mon Jul 23 16:38:52 2018 (UTC)
CIDSizeMRU
LastWrite: Mon Jul 23 17:55:21 2018
Note: All value names are listed in MRUListEx order.

  mmc.exe
  ServerManager.exe

LastVisitedPidlMRU
LastWrite: Mon Jul 23 17:55:21 2018
Note: All value names are listed in MRUListEx order.

  mmc.exe - My Computer\C:\Production

OpenSavePidlMRU
LastWrite: Mon Jul 23 16:48:15 2018
OpenSavePidlMRU\*
LastWrite Time: Mon Jul 23 17:55:21 2018
Note: All value names are listed in MRUListEx order.

  My Computer\C:\Production\update_app.bat
  My Computer\C:\Production\tcontinuous.exe
  My Computer\C:\Production\update_app.ps1
  Explorer

OpenSavePidlMRU\bat
LastWrite Time: Mon Jul 23 16:48:15 2018
Note: All value names are listed in MRUListEx order.

  My Computer\C:\Production\update_app.bat

OpenSavePidlMRU\exe
LastWrite Time: Mon Jul 23 17:37:37 2018
Note: All value names are listed in MRUListEx order.

  My Computer\C:\Production\tcontinuous.exe
  Explorer

OpenSavePidlMRU\ps1
LastWrite Time: Mon Jul 23 16:41:14 2018
Note: All value names are listed in MRUListEx order.

  My Computer\C:\Production\update_app.ps1

OpenSaveMRU(Windows Vista以降は OpenSavePidlMRU という名前になった)はWindows Common Dialog経由で開かれた/保存された直近20個のファイルの情報を記録しているらしい.

問われているのはbatファイルなので, update_app.batが正解.

FLAG : C:\Production\update_app.bat

HR Server - Application Q 1

What is the name of the hr management application that hosts a web server?

何という名前の"hr management application"をWebサーバがホストしているか?という問い.

最初はxamppの下に何かぶら下がったりしているかなと思って探してみたが, 無さそうだったので他を探す.

C:\Program Files配下を見ると"OrangeHRM"という名前のフォルダがあった.

動いているWebアプリケーションはこれだと思われる.

www.orangehrm.com

FLAG : OrangeHRM

HR Server - Application Q 2

What was the public url for the HR system's portal?

[format: http://*****]

上の問題にも出てきたOrangeHRMの公開URL?を問われている.

イメージファイルから C:\Prpgram Files\OrangeHRM\ をダンプして, C:\Program\Files\OrangeHRM\4.1\apache\logs\access.log を確認する.

最初はローカルIPアドレスを使用して hxxp://127.0.0.1/orangehrm-4.1/symfony/web/index.php/auth/login でテストをしているようで, 途中からグローバルIPアドレスを含むURL hxxp://74.118.139.108/symfony/web/index.php/auth/login になっている.

これを入れてみたら正解だった.

FLAG : http://74.118.139.108/symfony/web/index.php/auth/login

HR Server - Advanced

HR Server - Logon

At 2018-07-30 22:31:33 UTC which user was logged in under, what was the logon type (integer), and the logon process name?

[format: {TargetUserName} - {LogonType} - {LogonProcessName} - {IpAddress}]

Security.evtx の一番古いログを見た感じ, どうやらログが消去されているっぽくて辛い.

情報   2018/08/08 8:10:39  Eventlog    1102    ログの消去

消去されたログを復元したいなと思ったので, Volume Shadow Copy(VSS)からデータの復元をやってみる.

ewfmountコマンドでHRServer_Disk0.e01(EWF形式ファイル)をrawデータに変換&マウントする. マウント先のドライブレターは適当に選んでいる.

C:\Users\hamasho333\Desktop>ewfmount C:\Users\hamasho333\Desktop\HRServer_Disk0.e01 z:
ewfmount 20170703

ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \AutoRun.inf.

別のターミナルを開き, mmlsコマンドをZドライブに対して実行. パーティションの情報を取得する.

http://www.kazamiya.net/Sleuthkit/mmls

NTFSとして認識されている領域を確認し, オフセット値の計算をする.(512byte * 1026048 = 525336576)

C:\Users\hamasho333\Desktop>mmls Z:\EWF1
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

      Slot      Start        End          Length       Description
000:  Meta      0000000000   0000000000   0000000001   Primary Table (#0)
001:  -------   0000000000   0001026047   0001026048   Unallocated
002:  000:000   0001026048   0104857599   0103831552   NTFS / exFAT (0x07)

vshadowinfoコマンドでVSSの情報を確認する.

C:\Users\hamasho333\Desktop>vshadowinfo -o 525336576 Z:EWF1
vshadowinfo 20180403

Volume Shadow Snapshot information:
        Number of stores:       1

Store: 1
        Identifier              : 4479c1da-99b9-11e8-b7f4-acd82990ee82
        Shadow copy set ID      : 6e208bc2-d844-4751-b3c0-4aa8647b6beb
        Creation time           : Aug 07, 2018 23:07:58.044128300 UTC
        Shadow copy ID          : f4a62334-dad9-4483-b74c-bdddc61a7cf2
        Volume size             : 49 GiB (53161754624 bytes)
        Attribute flags         : 0x0002001d

ZドライブにマウントしたファイルのVSSをvshadowmountコマンドでXドライブにマウントする.

C:\Users\hamasho333\Desktop>vshadowmount -o 525336576 Z:\EWF1 X:
vshadowmount 20180403

vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \AutoRun.inf.

FTK ImagerでXドライブをHドライブにマウントし, エクスプローラから開く. H:\Windows\System32\winevt\Logsを開き, 目的のイベントログを取り出す.

f:id:echoha610:20181118230908p:plain

Security.evtxから, 問題文にあった時刻+9時間のログを確認する. このあたりのログが怪しい.

f:id:echoha610:20181118231404p:plain

このあたりのログを眺めると, ユーザ名はmpowers, ログオンタイプは10, ログオンプロセスはUser32, 接続元IPアドレスは74.118.138.195 であることが分かる.

FLAG : mpowers - 10 - User32 - 74.118.138.195

HR Server - Task Started

At 2018-07-27 02:42:43 (UTC), what is the name of the task that was started?

上の時刻に開始されたタスクの情報を確認する.

とりあえずWindowsのイベントログをチェックしてみる.

Windowsのタスクに関する情報が欲しいので, 確認するべきログは Microsoft-Windows-TaskScheduler%4Operational.evtx だと思う.

時間を+9時間して, 2018-07-27 11:42:43 で調査すると怪しいタスクが見つかった.

情報   2018/07/27 11:42:43 TaskScheduler   107 スケジューラによってトリガーされるタスク
タスク スケジューラは、時間による起動条件で、タスク "\Throw Taco" の "{937bb509-b699-4441-b2fe-bb167784d470}" インスタンスを起動しました。
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2018-07-23T10:37:58.8789474</Date>
    <Author>WIN-29U41M70JCO\mpowers</Author>
    <URI>\Throw Taco</URI>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT30M</Interval>
        <Duration>PT12H</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2018-07-23T08:12:42</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <RunLevel>HighestAvailable</RunLevel>
      <UserId>mpowers</UserId>
      <LogonType>Password</LogonType>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Production\tcontinuous.exe</Command>
      <Arguments>tthrow.exe 74.118.139.11:7420</Arguments>
      <WorkingDirectory>C:\Production</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

FLAG : Throw Taco

HR Server - HR System 1

Which IP address was accessing the OrangeHRM portal via Chrome 68.0.3440.84?

OrangeHRM portal に User-Agent "Chrome 68.0.3440.84" でアクセスしてきているIPアドレスを確認したい.

イメージファイルから C:\Prpgram Files\OrangeHRM\ 以下をダンプしてあるので, grepする.

cat access.log | grep "Chrome/68.0.3440.84"
74.118.139.108 - - [07/Aug/2018:15:54:40 -0700] "GET /phpmyadmin HTTP/1.1" 301 345 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"
74.118.139.108 - - [07/Aug/2018:15:54:40 -0700] "GET /phpmyadmin/ HTTP/1.1" 200 13274 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"
(略)

FLAG : 74.118.139.108

HR Server - Web App

What version of Apache was being used?

[format: n.n]

上で抽出したディレクトリの中にある httpd.exe のプロパティ情報を見る.

f:id:echoha610:20181118224206p:plain

FLAG : 2.4

HR Server - Changes Q3

What is the integer representation for the reason code given a USN V2 record where the record's reason flags have the following:

USN_REASON_CLOSE | USN_REASON_DATA_EXTEND | USN_REASON_FILE_CREATE

よくわからないので問題文にある"USN V2"でググるマイクロソフト社のドキュメントが出てくる.

https://docs.microsoft.com/en-us/windows/desktop/api/winioctl/ns-winioctl-usn_record_v2

このページによると, 問題文にあるのはUSN RECORD構造体のメンバっぽい. 以下のように対応する値を使って計算する.

0x80000000 | 0x00000002 | 0x00000100 = 0x80000102

0x80000102 を10進数に変換すると 2147483906 になる.

FLAG : 2147483906

HR Server - Expert

HR Server - Web Traffic Q1

What was the top communicating IP address with the web server?

awkとsortとuniqで適当にやる.

cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head
 780 74.118.138.195
 361 99.191.150.129
 361 73.60.202.108
 361 68.34.44.44
 211 74.118.139.108
 193 24.63.119.107
 175 74.56.59.151
 139 104.9.181.249
 126 47.75.16.178
 125 47.90.92.121

FLAG : 74.118.138.195

HR Server - Web Traffic Q2

How many requests were made to the web server where the requested url contained a wget command within in?

wgetコマンドを含むリクエストの数を数える. そんなに多く無さそうだったので, 適当にgrepして行数を数えた.

FLAG : 101

Next

HR Server - NEXT!

Congrats! You found the password to the next image: tacotunities

You get a these bonus points!

The answer to the question is: nexttaco

次のイメージファイルの解凍パスワードはtacotunitiesらしい.

File Server - Basic

File Server - Basic 1

What is the volume serial number of the only partition on the File Server Disk Image

分からなかった.

File Server - Basic 2

What is the name of the examiner who made the Forensic Image?

FileServer_Disk0.txtを読んで確認した. Professor Frinkさん.

Examiner(s): Professor Frink

FLAG : Professor Frink

File Server - Basic 3

Who cleared the security event log?

今のところ登場人物はmpowersぐらいなので, 何となくmpowersと入れたら正解だった.

(何か情報を見落としていたかもだが)何を根拠にそう判断すべきだったのか…

FLAG : mpowers

File Server - Basic 4

What is the hostname of the computer?

HIVEファイル(SYSTEM)をRegRipperでParseする.

----------------------------------------
compname v.20090727
(System) Gets ComputerName and Hostname values from System hive

ComputerName    = WIN-M5327EF98B9
TCP/IP Hostname = WIN-M5327EF98B9
----------------------------------------

FLAG : WIN-M5327EF98B9

File Server - Basic 5

When was the computer last shutdown? UTC Time In the format of Month/Day/Year Hour:Minute:Second in 24 hour timr 1/1/2018 14:01:01

Windows OSのシャットダウン時刻はレジストリ(SYSTEM)に記録される.

ControlSet001\Control\Windows\ShutdownTime

RegRipperでHIVEファイル(SYSTEM)をParseする.

shutdown v.20080324
(System) Gets ShutdownTime value from System hive

ControlSet001\Control\Windows key, ShutdownTime value
ControlSet001\Control\Windows
LastWrite Time Thu Jul 26 10:16:16 2018 (UTC)
  ShutdownTime = Thu Jul 26 10:16:16 2018 (UTC)

FLAG : 7/26/2018 10:16:16

File Server - Basic 6

What is the Current Build number of Windows on the File Server computer?

当該イメージファイルの取得元であるWindows OSのビルド番号を答える.

RegRipperでHIVEファイル(SOFTWARE)をParseする.

winnt_cv v.20161123
(Software) Get & display the contents of the Windows NT\CurrentVersion key

WinNT_CV
Microsoft\Windows NT\CurrentVersion
LastWrite Time Thu Jul 26 10:16:11 2018 (UTC)

  RegisteredOrganization : 
  CurrentVersion : 6.1
  CurrentBuild : 7601
  CurrentBuildNumber : 7601
  CSDBuildNumber : 1130
  UBR : 24208
  SoftwareType : System
  InstallationType : Server
  SystemRoot : C:\windows
  PathName : C:\Windows
  RegisteredOwner : Windows User
  CSDVersion : Service Pack 1
  EditionID : ServerEnterprise
  CurrentType : Multiprocessor Free
  ProductId : 00486-001-0001076-84763
  BuildLab : 7601.win7sp1_ldr.180608-0600
  InstallDate : Sun Jan 29 12:46:34 2017 (UTC)
  ProductName : Windows Server 2008 R2 Enterprise
  BuildGUID : 42a35295-5f00-412a-848d-ec20475b15b7
  BuildLabEx : 7601.24168.amd64fre.win7sp1_ldr.180608-0600

FLAG : 7601

File Server - Basic 7

what was mpowers user id?

すぐにはピンと来なかったが, user id = SIDの末尾に付いてる値のことかなと思った.

普通に動いているWindows OSだと以下のようにwhoamiコマンド等で確認できる.

C:\Windows\system32>whoami /user

USER INFORMATION
----------------

ユーザー名                 SID
========================== ==============================================
desktop-656qs8t\hamasho333 S-1-5-21-3445110554-3326772599-3149076797-1001

イメージファイルの場合は, RegRipperでHIVEファイル(SOFTWARE)をParseし, profilelistの出力結果を見るとSIDを確認できる.

mpowersは1000, Administratorは500となっている.

profilelist v.20100219
(Software) Get content of ProfileList key

Microsoft\Windows NT\CurrentVersion\ProfileList
LastWrite Time Mon Jul 16 17:04:45 2018 (UTC)

Path      : %systemroot%\system32\config\systemprofile
SID       : S-1-5-18
LastWrite : Tue Jul 14 04:57:00 2009 (UTC)

Path      : C:\Windows\ServiceProfiles\LocalService
SID       : S-1-5-19
LastWrite : Sun Jan 29 12:44:09 2017 (UTC)

Path      : C:\Windows\ServiceProfiles\NetworkService
SID       : S-1-5-20
LastWrite : Sun Jan 29 12:44:09 2017 (UTC)

Path      : C:\Users\mpowers
SID       : S-1-5-21-1223297778-3299746493-1462173606-1000
LastWrite : Wed Aug  8 21:37:04 2018 (UTC)
LoadTime  : Thu Jan  1 00:00:00 1970 (UTC)

Path      : C:\Users\Administrator
SID       : S-1-5-21-1223297778-3299746493-1462173606-500
LastWrite : Wed Aug  8 20:27:39 2018 (UTC)
LoadTime  : Thu Jan  1 00:00:00 1970 (UTC)

FLAG : 1000

File Server - Basic 8

Which program did Max Powers last run through the GUI?

Max Powers(mpowers?)が最後にGUI経由で実行したプログラムは何か?という問題.

explorer.exeから実行されたプログラムを確認すれば良さそうなので, HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist に記録されているデータを確認する.

RegRipperでNTUSER.datをParseし, UserAssistの出力結果を見る.

一番最後に実行されているのは C:\Users\mpowers\Desktop\sub-win-x64_104.148.109.124_5682_3262.exe であることが分かる.

UserAssist
Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist
LastWrite Time Mon Jul 16 17:05:01 2018 (UTC)

{CEBFF5CD-ACE2-4F4F-9178-9926F41749EA}
Wed Aug  8 21:37:04 2018 Z
  C:\Users\mpowers\Desktop\sub-win-x64_104.148.109.124_5682_3262.exe (2)
Wed Aug  8 00:16:07 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\services.msc (1)
Tue Aug  7 23:59:01 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\msiexec.exe (2)
Tue Aug  7 23:57:57 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\ServerManager.msc (1)
Tue Aug  7 20:33:21 2018 Z
  Microsoft.Windows.RemoteDesktop (1)
Tue Aug  7 20:16:34 2018 Z
  Chrome (4)
Tue Aug  7 20:13:14 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\cmd.exe (16)
Tue Aug  7 20:05:30 2018 Z
  {F38BF404-1D43-42F2-9305-67DE0B28FC23}\explorer.exe (6)
Mon Jul 30 22:44:12 2018 Z
  {6D809377-6AF0-444B-8957-A3773F02200E}\Notepad++\notepad++.exe (4)
Mon Jul 30 22:43:35 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe (3)
Tue Jul 24 15:47:39 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WF.msc (2)
Mon Jul 16 17:03:14 2018 Z
  {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\notepad.exe (13)
  Microsoft.InternetExplorer.Default (12)

FLAG : sub-win-x64_104.148.109.124_5682_3262.exe

File Server - Basic 9

When did Max Powers last open projections.zip? UTC TIme Day/Month/year Hour:Minute:Sec in 24 hour time 1/1/2018 15:20:11

projections.zipが最後に開かれたのはいつ?という問題.

MFTやUSN JournalをParseした結果を確認したが, projections.zip というファイルは無さそうだった. 削除されたいるか?

削除されたファイルの調査をする必要がありそうなので, HR Serverの時と同様に, VSSからファイルを復元したい.

ewfmountコマンドでイメージファイルをマウントする.

C:\Users\hamasho333\Desktop>ewfmount C:\Users\hamasho333\Desktop\FileServer_Disk0.e01 z:
ewfmount 20170703

ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \autorun.inf.
ewfmount_dokan_CreateFile: unsupported path: \AutoRun.inf.
ewfmount_dokan_CreateFile: unsupported path: \desktop.ini.
ewfmount_dokan_CreateFile: unsupported path: \desktop.ini.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \desktop.ini.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.
ewfmount_dokan_CreateFile: unsupported path: \E*.

別のターミナルを開き, mmlsコマンドでマウントしたドライブのパーティションを確認する.

512 * 206848 = 105906176 をオフセット値に指定して, vshadowmountコマンドでVSS領域をマウントする.

C:\Users\hamasho333\Desktop>mmls Z:\EWF1
DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

      Slot      Start        End          Length       Description
000:  Meta      0000000000   0000000000   0000000001   Primary Table (#0)
001:  -------   0000000000   0000206847   0000206848   Unallocated
002:  000:000   0000206848   0104857599   0104650752   NTFS / exFAT (0x07)
C:\Users\hamasho333\Desktop>vshadowinfo -o 105906176 Z:\EWF1
vshadowinfo 20180403

Volume Shadow Snapshot information:
        Number of stores:       1

Store: 1
        Identifier              : f491dfb8-90bc-11e8-a336-c4ce02cc7d80
        Shadow copy set ID      : 14ab8568-c9d2-43fe-95b9-cff35620ecc4
        Creation time           : Aug 07, 2018 20:13:26.796375000 UTC
        Shadow copy ID          : 4932ca0c-4609-4ce1-8182-1be0a0d85f8c
        Volume size             : 49 GiB (53581185024 bytes)
        Attribute flags         : 0x0002001d

C:\Users\hamasho333\Desktop>vshadowmount -o 105906176 Z:\EWF1 X:
vshadowmount 20180403

vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \autorun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \AutoRun.inf.
vshadowmount_dokan_CreateFile: unsupported path: \desktop.ini.
vshadowmount_dokan_CreateFile: unsupported path: \desktop.ini.

マウントしたドライブをFTK Imagerで開き, USN Journalを取り出す.

USN JournalをUSN AnalyticsでParseし, Projections.zipに関連するログを確認する.

2018/08/08 05:09:39にFileServerShare.zipという名前にリネームされている. その直前がファイルを開いた際のログっぽかったので, これを-9時間して入力したら正解だった.

"1862451536" "2" "2018/08/08 05:09:15.749500"    "0.000000"  "Projections.zip"   "OBJECTID|CLOSE"    "ARCHIVE"   "66226" "35843" "New folder\ -> test\"   
"1862452448"    "3" "2018/08/08 05:09:15.765125"    "0.000000"  "Projections.lnk"   "CREATE|EXTEND|CLOSE"   "ARCHIVE"   "66225" "85214" ""  
"1862453024"    "3" "2018/08/08 05:09:39.624500"    "0.000000"  "Projections.zip -> FileServerShare.zip" "RENAME"    "ARCHIVE"   "66226" "35843" "New folder\ -> test\"   

FLAG : 8/7/2018 20:09:15

File Server - Basic 10

How many clusters are on the partition?

分からなかった.

File Server - Advanced

File Server - Advanced 1

Where does the \VSS directory go?

イメージファイルをArsenalImageMounterでマウントして確認すると, vssディレクトリはショートカットファイルになっているように見える.

f:id:echoha610:20181118220018p:plain

FTK Imagerでイメージファイルを読み込み、ショートカットファイルを調査すると以下のパスが確認できる.

FLAG : \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\

File Server - Advanced 2

When was the Volume Shadow Copy 1 created? Enter answer in UTC TIme in the following format 1/1/2018 13:11:11 Month/Day/Year 24 Hour Time

先に実行したのvshadowinfoコマンドの実行結果を再度確認する.

Creation time           : Aug 07, 2018 20:13:26.796375000 UTC

FLAGは 8/7/2018 20:13:26 だと思うのだが, Submitすると何故か弾かれてしまう...

File Server - Advanced 3

Where did Max Powers login from?

Max Powers(mpowers)がWebサーバにどこからログインしているかを問われている.

恐らくRDP接続とかでWebサーバにログインしていると思われるので, その接続元IPアドレスを確認したい.

以下の資料によると, RDPのログは Security.evtx か Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx を調査すると良いらしい. 調査にはEvent Log Explorerを使用する.

https://sect.iij.ad.jp/d/2018/05/044132/training_material_sample_for_eventlog_analysis.pdf

Security.evtx にはIPアドレスは記録されて無さそうだったので, Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx を調査する.

mpowersは複数のIPアドレスからWebサーバに接続しているようだった.

イベントID:21(ログインの成功)に注目して一番古いログを探す.

一番最初にmpowersがWebサーバに接続した際のイベントログは以下の通り. 74.118.138.195から接続している.

Type :       Information
Date :      2018/07/17
Time :      2:04:46
Event :     21
Source :        Microsoft-Windows-TerminalServices-LocalSessionManager
Category :  None
User :      \SYSTEM
Computer :  WIN-M5327EF98B9
Description:
リモート デスクトップ サービス: セッション ログオンに成功しました:
ユーザー: WIN-M5327EF98B9\mpowers
セッション ID: 2
ソース ネットワーク アドレス: 74.118.138.195

FLAG : 74.118.138.195

File Server - Advanced 4

What program was used to delete forensic artifacts?

アーティファクトを削除するのに、何というプログラムが使用されたかを問われている.

NTUSER.DATから, mpowersの環境内で実行されたファイルを確認する.

notepad.exeやcleanmgr.exeが実行されているがこの辺は正規ファイルと思われるので無視.

C:\Users\mpowers\Desktop\PrivaZer.exe は見慣れない名前のファイルで, しかも実行場所がデスクトップになっていて怪しい.

「PrivaZer」でGoogle検索すると, これがクリーンツールだということが分かった.

f:id:echoha610:20181118215627p:plain

FLAG : PrivaZer

File Server - Advanced 5

What is the name of the zip file that contains the M4Projects directory?

M4Projectsディレクトリを含んでいるzipファイルの名前を問われている.

イメージファイルをマウント後, M4Projectsディレクトリやその1階層上を確認したがzipファイルは無さそう. おそらくファイルは削除されている.

VSSをマウントしてM4Projectsディレクトリを確認すると, project_0x01, project_0x02, project_0x03, projectionsというディレクトリがあるので, これらを含むzipファイルを探せば良いのか?

mpowersユーザのデスクトップにproject_0x03.zipというファイルがあり, その中にproject_0x01, project_0x02, projectionsディレクトリが含まれている.

E:\Users\mpowers\Desktop\mpowers\Desktop\project_0x03.zip

更に, 先の問題でも登場した FileServerShare.zip というファイルもあった. project_0x03.zipと中身の構成は同じっぽい.

E:\Users\mpowers\Desktop\mpowers\Desktop\FileServerShare.zip

どちらかが正解っぽいが, 答えを断定する根拠が無い気がする. とりあえず両方投げてみたらFileServerShare.zipが正解だった.

FLAG : FileServerShare.zip

File Server - Advanced 6

What host was used to exfil the data?

何というhostがファイルを持ち出すのに使用されたかを問われている.

hostが何を指しているのかよく分からないが, 使用されたツールとかWebサービスとかを調べろということだと思う.

とりあえずBrowsingHistoryViewでIEのアクセス履歴を確認したが, Google Chromeをダウンロードしたログがあるぐらいだった. もっとIEを使ってあげてほしい.

https://www.nirsoft.net/utils/browsing_history_view.html

今度はHindSightを使ってGoogle Chromeのアクセス履歴を解析した.

https://github.com/obsidianforensics/hindsight

Chromeのアクセス履歴は %AppData%\Google\Chrome\User Data\Default に保存される.

C:\Users\hamasho\Desktop>hindsight.exe -i "F:\Users\mpowers\AppData\Local\Google\Chrome\User Data\Default"

################################################################################

                   _     _           _     _       _     _
                  | |   (_)         | |   (_)     | |   | |
                  | |__  _ _ __   __| |___ _  __ _| |__ | |_
                  | '_ \| | '_ \ / _` / __| |/ _` | '_ \| __|
                  | | | | | | | | (_| \__ \ | (_| | | | | |_
                  |_| |_|_|_| |_|\__,_|___/_|\__, |_| |_|\__|
                                              __/ |
                        by @_RyanBenson      |___/   v2.2.0

################################################################################

       Start time: 2018-11-17 12:08:39.430
  Input directory: F:\Users\mpowers\AppData\Local\Google\Chrome\User Data\Default
      Output name: Hindsight Report (2018-11-17T12-08-39).xlsx

 Processing:
                     Detected Chrome version:            [     66 ]
                                 URL records:            [      0 ]
                            Download records:            [      0 ]
                               Cache records:            [ Failed ]
                           GPU Cache records:            [ Failed ]
                              Cookie records:            [     39 ]
                            Autofill records:            [      0 ]
                       Local Storage records:            [      0 ]
                                  Extensions:            [      9 ]
                          Login Data records:            [      0 ]
                            Preference Items:            [      7 ]
                           File System Items:            [      0 ]

 Running plugins:
          Chrome Extension Names (v20150125):   - 0 extension URLs parsed -
       Generic Timestamp Decoder (v20160907):     - 0 timestamps parsed -
  Google Analytics Cookie Parser (v20170130):       - 0 cookies parsed -
                 Google Searches (v20160912):      - 0 searches parsed -
    Load Balancer Cookie Decoder (v20160621):       - 0 cookies parsed -
         Quantcast Cookie Parser (v20160907):       - 0 cookies parsed -
             Query String Parser (v20170225):    - 0 query strings parsed -
         Time Discrepancy Finder (v20170129):     - 0 differences parsed -

 Writing Hindsight Report (2018-11-17T12-08-39).xlsx
('\n Finish time: ', '2018-11-17 12:08:39.665')

CSVに吐き出されたデータを眺めてみると, 先ほどアーティファクトの削除に使われていたPrivazerをダウンロードした時のアクセスログが見える.

その6分前にDropBoxへのアクセスがあり, とても怪しい.

preference   2018-08-07 20:15:45.913 https://www.dropbox.com:443,*   media_engagement [in Preferences.profile.content_settings.exceptions]   {u'last_modified': u'13178146545913875', u'setting': {u'mediaPlaybacks': 0, u'lastMediaPlaybackTime': 0, u'visitsWithMediaTag': 0, u'audiblePlaybacks': 0, u'visits': 2, u'highScoreChanges': 0, u'significantPlaybacks': 0, u'hasHighScore': False}}

preference  2018-08-07 20:21:39.089 https://privazer.com:443,*

DropBox経由でデータを持ち出したと推測して, www.dropbox.com をSubmitすると正解だった.

FLAG : www.dropbox.com

File Server - Advanced 7

What is the url where the data was exfiled to?

分からなかった.

File Server - Advanced 8

What registry files did the attacker take? Please list them in alphabetical order with a space in between the names

分からなかった. Advanced 6~8は関連している雰囲気. DropBoxにアップロードしたファイルの調査が必要か?

File Server - Advanced 9

What did the USN Journal get wiped with?

何がUSNジャーナルを削除したかを問われている. 先の問題でも問われていた, PrivaZerだと思う.

PrivaZerでSubmitしたら弾かれたので, PrivaZer.exeで投げたら通った.

FLAG : PrivaZer.exe

File Server - Advanced 10

What service did the attacker use to access this system?

このシステムにアクセスするのに, 攻撃者はどんなサービスを使用したかが問われている.

先の問題でRDP接続していたログがあったしRDPなのでは? と思ってSubmitしたら正解だった.

FLAG : rdp

File Server - Next!

You found the source, the next password for image 3 is viviaalpastortacos

次のイメージファイルの解凍パスワードが分かった. 続きはそのうちやっていきます.

まだ解けていない問題も解けたら解法を適宜追加予定.

参考情報

  • インシデントレスポンス 第3版 コンピューターフォレンジックの基礎と実践(Jason T. Luttgens/Matthew Pepe/Kevin Mandia 著)

  • 他の方のWriteup

infosecuritygeek.com