Time Matters - Securinets CTF Quals 2020 Forensics writeup
世間は4月の終わりを迎えているが、writeupの3月の終わりが中々迎えられない人です。
今回は、2020/03/22 2:00 - 03/32 2:00 JSTに行われた 「Securinets CTF Quals 2020」の「Time Matters」をお届け。
Time Matters
Just do some magic on this file
では与えられたファイル「for1.zip」に関してコチラ。
# file for1.zip for1.zip: Zip archive data, at least v2.0 to extract # unzip for1.zip Archive: for1.zip inflating: for1.raw # file for1.raw for1.raw: ELF 64-bit LSB core file, x86-64, version 1 (SYSV)
メモリダンプぽいので、volatilityへ。
# volatility -f for1.raw imageinfo Volatility Foundation Volatility Framework 2.6 INFO : volatility.debug : Determining profile based on KDBG search... Suggested Profile(s) : Win7SP1x86_23418, Win7SP0x86, Win7SP1x86_24000, Win7SP1x86 AS Layer1 : IA32PagedMemoryPae (Kernel AS) AS Layer2 : VirtualBoxCoreDumpElf64 (Unnamed AS) AS Layer3 : FileAddressSpace (/root/CTF/SecurinetsCTF2020/For/Time_matters/for1.raw) PAE type : PAE DTB : 0x185000L KDBG : 0x82785b78L Number of Processors : 1 Image Type (Service Pack) : 1 KPCR for CPU 0 : 0x83583000L KUSER_SHARED_DATA : 0xffdf0000L Image date and time : 2020-03-20 12:39:50 UTC+0000 Image local date and time : 2020-03-20 13:39:50 +0100
profileはWin7SP1x86でいく。
# volatility --profile=Win7SP1x86 -f for1.raw pstree Volatility Foundation Volatility Framework 2.6 Name Pid PPid Thds Hnds Time -------------------------------------------------- ------ ------ ------ ------ ---- 0x84929030:wininit.exe 392 348 3 76 2020-03-20 12:38:07 UTC+0000 . 0x850f8620:lsm.exe 500 392 10 148 2020-03-20 12:38:07 UTC+0000 . 0x850ef458:services.exe 484 392 8 195 2020-03-20 12:38:07 UTC+0000 .. 0x851ae4e8:svchost.exe 896 484 31 552 2020-03-20 12:38:08 UTC+0000 ... 0x84986b30:dwm.exe 476 896 5 77 2020-03-20 12:38:25 UTC+0000 .. 0x85211af8:svchost.exe 1260 484 18 384 2020-03-20 12:38:09 UTC+0000 .. 0x851ce030:svchost.exe 984 484 38 827 2020-03-20 12:38:08 UTC+0000 ... 0x8540f730:taskeng.exe 384 984 8 93 2020-03-20 12:38:25 UTC+0000 .... 0x849296d8:csrss.exe 400 384 8 316 2020-03-20 12:38:07 UTC+0000 .... 0x84b2dd20:winlogon.exe 440 384 5 118 2020-03-20 12:38:07 UTC+0000 .... 0x8546e7b8:GoogleUpdate.e 1240 384 6 114 2020-03-20 12:38:26 UTC+0000 .. 0x85155030:VBoxService.ex 668 484 13 125 2020-03-20 12:38:08 UTC+0000 .. 0x854e7848:svchost.exe 2336 484 11 355 2020-03-20 12:38:34 UTC+0000 .. 0x842f41a8:taskhost.exe 296 484 12 228 2020-03-20 12:38:25 UTC+0000 .. 0x851c5030:svchost.exe 940 484 33 505 2020-03-20 12:38:08 UTC+0000 .. 0x8bee6030:svchost.exe 1072 484 5 118 2020-03-20 12:38:08 UTC+0000 .. 0x85183578:svchost.exe 776 484 24 520 2020-03-20 12:38:08 UTC+0000 ... 0x851d3310:audiodg.exe 1036 776 5 125 2020-03-20 12:38:08 UTC+0000 .. 0x8547ad20:wmpnetwk.exe 2056 484 16 439 2020-03-20 12:38:33 UTC+0000 .. 0x84804c28:WmiApSrv.exe 3468 484 7 116 2020-03-20 12:38:47 UTC+0000 .. 0x8523c790:spoolsv.exe 1360 484 17 298 2020-03-20 12:38:09 UTC+0000 .. 0x85165b40:svchost.exe 724 484 7 285 2020-03-20 12:38:08 UTC+0000 .. 0x852e3688:svchost.exe 1496 484 28 293 2020-03-20 12:38:09 UTC+0000 .. 0x85148030:svchost.exe 608 484 13 365 2020-03-20 12:38:07 UTC+0000 ... 0x854beb98:WmiPrvSE.exe 3040 608 7 129 2020-03-20 12:38:40 UTC+0000 ... 0x85575810:WmiPrvSE.exe 2524 608 15 317 2020-03-20 12:38:36 UTC+0000 .. 0x85255d20:svchost.exe 1396 484 19 306 2020-03-20 12:38:09 UTC+0000 .. 0x85421510:SearchIndexer. 1236 484 13 612 2020-03-20 12:38:33 UTC+0000 ... 0x847fba38:SearchFilterHo 2176 1236 6 84 2020-03-20 12:38:34 UTC+0000 ... 0x854acc28:SearchProtocol 2136 1236 8 262 2020-03-20 12:38:34 UTC+0000 . 0x85100698:lsass.exe 492 392 9 738 2020-03-20 12:38:07 UTC+0000 0x848bc540:csrss.exe 356 348 8 467 2020-03-20 12:38:07 UTC+0000 0x839af9d0:System 4 0 85 529 2020-03-20 12:38:06 UTC+0000 . 0x8485c880:smss.exe 280 4 2 29 2020-03-20 12:38:06 UTC+0000 0x8505f030:explorer.exe 328 404 38 883 2020-03-20 12:38:25 UTC+0000 . 0x85456760:VBoxTray.exe 1888 328 13 138 2020-03-20 12:38:26 UTC+0000 . 0x854dad20:chrome.exe 2288 328 29 666 2020-03-20 12:38:34 UTC+0000 .. 0x842fdbb0:chrome.exe 2888 2288 10 170 2020-03-20 12:38:39 UTC+0000 .. 0x842fed20:chrome.exe 2692 2288 14 301 2020-03-20 12:38:37 UTC+0000 .. 0x85597030:chrome.exe 2588 2288 2 55 2020-03-20 12:38:36 UTC+0000 .. 0x854e92a0:chrome.exe 2356 2288 8 64 2020-03-20 12:38:34 UTC+0000 .. 0x8431ed20:chrome.exe 3260 2288 13 224 2020-03-20 12:38:43 UTC+0000 .. 0x847f8d20:software_repor 3344 2288 11 197 2020-03-20 12:38:45 UTC+0000 ... 0x856a7328:software_repor 3356 3344 7 82 2020-03-20 12:38:46 UTC+0000 ... 0x84816410:software_repor 3500 3344 3 106 2020-03-20 12:38:48 UTC+0000 ... 0x84884c28:software_repor 3792 3344 2 96 2020-03-20 12:39:00 UTC+0000
とりあえず、pstree見てみたけど、何に注目するか分からん。何となくchromeを見るべきなのだろうか。
chromeの履歴でも見てみるか。
# volatility --profile=Win7SP1x86 -f for1.raw filescan | grep History Volatility Foundation Volatility Framework 2.6 0x000000001e0bfe88 8 0 R--rw- \Device\HarddiskVolume2\Users\studio\AppData\Local\Google\Chrome\User Data\Default\History-journal 0x000000001e0c0590 8 1 RW-rw- \Device\HarddiskVolume2\Users\studio\AppData\Local\Google\Chrome\User Data\Default\History 0x000000001e2278e0 9 1 RW-rw- \Device\HarddiskVolume2\Users\studio\AppData\Local\Google\Chrome\User Data\Default\History-journal # volatility --profile=Win7SP1x86 -f for1.raw dumpfiles -Q 0x000000001e0c0590 -D ./ Volatility Foundation Volatility Framework 2.6 DataSectionObject 0x1e0c0590 None \Device\HarddiskVolume2\Users\studio\AppData\Local\Google\Chrome\User Data\Default\History SharedCacheMap 0x1e0c0590 None \Device\HarddiskVolume2\Users\studio\AppData\Local\Google\Chrome\User Data\Default\History # mv file.None.0x8515bde0.dat History.db # strings History.db | less
SQLite format 3 A/early_expiration_threshold13221664482196741 last_compatible_version16 version42 mmap_status-1 early_expiration_threshold last_compatible_version version # mmap_status https://www.google.com/search?q=google&oq=google&aqs=chrome..69i57j0l7.931j0j7&sourceid=chrome&ie=UTF-8google - Google Search urls googlegoogle
ヒントにも成らん。うむ、分からんけどmimikatzしてみる。
# volatility --profile=Win7SP1x86 -f for1.raw mimikatz Volatility Foundation Volatility Framework 2.6 Module User Domain Password -------- ---------------- ---------------- ---------------------------------------- wdigest studio studio-PC Messi2020 wdigest STUDIO-PC$ WORKGROUP
何か出た。けれど、何の手がかりなのだろうか。
その後色々volatilityのコマンドを試してもよく分からないので、いざUserのfilescan沼へ向かう。ひたすらグダグダとユーザのファイルを漁っていく。
この作業は果たして報われるのかと思いながらやっていたところ、Desktopフォルダにて面白いものを発見。
# volatility --profile=Win7SP1x86 -f for1.raw filescan | grep "studio" | grep "Desktop" Volatility Foundation Volatility Framework 2.6 0x000000001e200038 2 1 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop 0x000000001e246af0 2 1 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop 0x000000001e24a0e8 2 1 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop\steghide 0x000000001e24bcd0 2 1 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop\steghide 0x000000001e45e730 8 0 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop\DS0394.jpg 0x000000001ed2fa30 8 0 R--rwd \Device\HarddiskVolume2\Users\studio\Desktop\desktop.ini 0x000000001ee76f80 8 0 R--rwd \Device\HarddiskVolume2\Users\studio\AppData\Roaming\Microsoft\Windows\SendTo\Desktop.ini
明らかに、steghideと画像ファイルが同じフォルダにあるって怪しい。
# volatility --profile=Win7SP1x86 -f for1.raw dumpfiles -Q 0x000000001e45e730 -D ./ Volatility Foundation Volatility Framework 2.6 DataSectionObject 0x1e45e730 None \Device\HarddiskVolume2\Users\studio\Desktop\DS0394.jpg # mv file.None.0x85f45558.dat DS0394.jpg # file DS0394.jpg DS0394.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, baseline, precision 8, 1200x675, components 3
一応確認すると、
これはメッシである。
CTFやってて、「これはメッシである。」なんて言う日が来るとは思わなかった。steghideを利用する。
# steghide --extract -sf DS0394.jpg Enter passphrase: steghide: could not extract any data with that passphrase!
パスワードが必要だってばよ。パスワードといえば、さっき「Messi2020」というのを見た気がしますね。実はそれを入力したところ違ったのです。
てか、Messiのjpegに「29/08/2019」って態々書いてあるの不思議でわ。Messi2019?
# steghide --extract -sf DS0394.jpg Enter passphrase: wrote extracted data to "image.png". # file image.png image.png: PNG image data, 1200 x 675, 8-bit grayscale, non-interlaced
flag: Securinets {c7e2723752111ed983249627a3d752d6}
忍耐と勘の問題だった。