4ensiX

4ensiX

FPと言ったものはFPを選んだが表示はTPになっていることに気づいた。

riftCTF2020 Stegano writeup

5月なのに何で3月のCTFのwriteup書いているんだろと自問自答している。
今回は2020/03/20 15:30 JST - 03/21 15:30に行われた「riftCTF2020」のStegano writeupをお届けする。

ctftime.org

Stegano_0x0001

Stegano 0x0001
100
EASY
wubba lubba dub dub

author:- Mr.7i74N

与えられたファイル「chall1.jpeg」に関して、手当たり次第にみていく。

# file chall1.jpeg 
chall1.jpeg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, progressive, precision 8, 1300x650, components 3
root@kali:~/CTF/riftCTF2020/Stegano/Stegano_0x0001# binwalk chall1.jpeg 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             JPEG image data, JFIF standard 1.01

root@kali:~/CTF/riftCTF2020/Stegano/Stegano_0x0001# exiftool chall1.jpeg 
ExifTool Version Number         : 11.94
File Name                       : chall1.jpeg
Directory                       : .
File Size                       : 116 kB
File Modification Date/Time     : 2020:03:24 01:51:50-04:00
File Access Date/Time           : 2020:05:01 07:09:22-04:00
File Inode Change Date/Time     : 2020:04:10 23:50:02-04:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 72
Y Resolution                    : 72
Image Width                     : 1300
Image Height                    : 650
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1300x650
Megapixels                      : 0.845
root@kali:~/CTF/riftCTF2020/Stegano/Stegano_0x0001# strings chall1.jpeg | grep rift
riftCTF{R1ck_4ND_the_r1ft}

flag: riftCTF{R1ck_4ND_the_r1ft}
一番それはやめてくれ案件がflagであることがあるのはアリアリ

Stegano_0x0003

Stegano 0x0003
200
The universal language
author:- Mr.7i74N

文字コード系問題? 与えられたファイル「chall3.wav」に関して

# file chall3.wav 
chall3.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 22050 Hz
root@kali:~/CTF/riftCTF2020/Stegano/Stegano_0x0003# mpv chall3.wav 
[ffmpeg/demuxer] wav: Discarding ID3 tags because more suitable tags were found.
 (+) Audio --aid=1 (pcm_s16le 2ch 22050Hz)
AO: [pulse] 22050Hz stereo 2ch s16
A: 00:01:01 / 00:01:02 (99%)


Exiting... (End of file)

音声ファイルのようで、聞いてみると始めの方に違和感を感じたのでaudacityで開く。

# audicity chall3.wav 
bash: audicity: コマンドが見つかりません
# audicaty chall3.wav 
bash: audicaty: コマンドが見つかりません
# audichall3.wav 
bash: audichall3.wav: コマンドが見つかりません
# audacity chall3.wav 

audacity開くのに毎回3回くらい間違える。

f:id:Zarat:20200501202025p:plain
audacityで「chall3.wav」を開く
やはり、始めの方に違和感がある。
拡大してみると
f:id:Zarat:20200501202139p:plain
8秒あたりを拡大したらflag
flag: riftCTF{Music_is_Fr33d0m}
ねぇ、本当にどうやって作っているのか誰か教えてください。

Stegano_0x0004

Stegano 0x0004
200
Don't download pirated music guys, it's not respectful towards the artist.

与えられたファイル「chall4.wav」に関して

# file chall4.wav 
chall4.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
# mpv chall4.wav 
[ffmpeg/demuxer] wav: Discarding ID3 tags because more suitable tags were found.
 (+) Audio --aid=1 (pcm_s16le 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch s16
A: 00:01:01 / 00:01:01 (99%)


Exiting... (End of file)

何も無さ過ぎて分からん。 audacityで開いても手がかりなく。 どうするもんかと思いつつ。
これだけは止めてくれ、絶対にあるはずがないと手が動いてしまった。

# strings chall4.wav | grep rift
riftCTF{I_4m_th3_cr3at0r}

flag: riftCTF{I_4m_th3_cr3at0r}
悲しい(´・ω・`)

riftCTF2020 Forensic writeup

3月が終わっていないのに、5月になってしまったヤバい。
焦りつつ今回は2020/03/20 15:30 JST - 03/21 15:30に行われた「riftCTF2020」のForensics writeupをお届けする。
解けてないのもある。

ctftime.org

Forensics 0x0001

Forensics 0x0001
100
EASY
1.identify the file format.
2.read about the file format.
3.see which properties this particular file has.
4.and fix the file to get the flag.
5.brute-forcing won't help but you can do whatever you want.
6.flag format riftCTF{<---flag-here--->}. Good Luck!
author - X3eRo0r

与えられたファイル「flag.zip」に関して

# file flag.zip 
flag.zip: Zip archive data, at least v2.0 to extract
# unzip flag.zip 
Archive:  flag.zip
   skipping: flag.txt                unsupported compression method 99

unzipがサポートしていないアルゴリズムということで、7zipを使う。

# 7za x flag.zip 

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=ja_JP.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (806EA),ASM,AES-NI)

Scanning the drive for archives:
1 file, 260 bytes (1 KiB)

Extracting archive: flag.zip

ERRORS:
Headers Error

--
Path = flag.zip
Type = zip
ERRORS:
Headers Error
Physical Size = 260

    
Enter password (will not be echoed):
ERROR: Wrong password : flag.txt
               
Sub items Errors: 1

Archives with Errors: 1

Open Errors: 1

Sub items Errors: 1

何かエラー吐いている気がするけどパスワードが無いとだめダト。
とりあえずjohn。

# zip2john fixed.zip > ziphash
# john --wordlist=/usr/share/wordlists/rockyou.txt ziphash
# john --show ziphash 
flag.zip/flag.txt:general:flag.txt:flag.zip:flag.zip

パスワードは「general」と分かったので、7zipをもう一度。

# 7za x flag.zip 

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=ja_JP.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (806EA),ASM,AES-NI)

Scanning the drive for archives:
1 file, 260 bytes (1 KiB)

Extracting archive: flag.zip

ERRORS:
Headers Error

--
Path = flag.zip
Type = zip
ERRORS:
Headers Error
Physical Size = 260

    
Enter password (will not be echoed):
               

Archives with Errors: 1

Open Errors: 1
# cat flag.txt 
riftCTF{th1s-1S-_JUST--TH3-B3g3nn1ng-BRUH}

開けたのは良いが、エラー吐いているのが気になる。
flag: riftCTF{th1s-1S-_JUST--TH3-B3g3nn1ng-BRUH}

Forensics 0x0002

Forensics 0x0002
300
1.identify the file format.
2.read about the file format.
3.see which properties this particular file has.
4.and fix the file to get the flag.
5.brute-forcing won't help but you can do whatever you want.
6.flag format ritsCTF{<---flag-here--->}. Good Luck.!
author - X3eRo0r

与えられたファイル「flag.zip」に関して

# file flag.zip 
flag.zip: Zip archive data, at least v2.0 to extract
# unzip flag.zip 
Archive:  flag.zip
[flag.zip] flag.txt password: 
   skipping: flag.txt                incorrect password

またパスワードか。
johnの出番。

# zip2john flag.zip > ziphash
flag.zip/flag.txt is not encrypted!

john「このzipは暗号化されてないよ」?????
unzipしようとするとパスワードを聞かれるけど、johnは暗号化されいないという。
つまり、zipは暗号化されていないけどパスワード要求させるフラグみたいなのを立ててる?
どうしようかと思っていた時、こんなのを発見

-FF --fixfix ZIPファイルを修復する(「-F」では修復できなかったファイルも修復できる可能性がある)

【 zip 】コマンド(応用編)――ZIPファイルを作成して元のファイルを削除する:Linux基本コマンドTips(36) - @IT

使ってみよ。

# zip -FF flag.zip --out fixed.zip
Fix archive (-FF) - salvage what can
 Found end record (EOCDR) - says expect single disk archive
Scanning for entries...
 copying: flag.txt  (51 bytes)
Central Directory found...
EOCDR found ( 1    143)...
# unzip fixed.zip 
Archive:  fixed.zip
  inflating: flag.txt      
# cat flag.txt 
riftCTF{Y0u-M4st33r3-THE_ZIP_FILE-\x50\x4B\x01\x02}          

flag: riftCTF{Y0u-M4st33r3-THE_ZIP_FILE-\x50\x4B\x01\x02}
zip -FFマジ忘れない。
ここで先ほど気になったパスワードあるようにみせるビットを見てみる。

# cmp flag.zip fixed.zip 
flag.zip fixed.zip 異なります: バイト 98、行 1

実際確認してみると

f:id:Zarat:20200501190944p:plain
「flag.zip」と「fixed.zip」
ここが暗号化ビット?
ここら辺をみると何か分かりそうな気がする。
盛大にぶっ壊れたパスワード付きzipを解析してみる - yumetodoの旅とプログラミングとかの記録
ZIPの仕様を日本語でまとめる · GitHub

Forensics 0x0003(No solved)

Forensics 0x0003
300
1.identify the file format.
2.read about the file format.
3.see which properties this particular file has.
4.and fix the file to get the flag.
5.brute-forcing won't help but you can do whatever you want.
6.flag format ritsCTF{<---flag-here--->}. Good Luck!
author - X3eRo0

与えられたファイル「flag.zip」について

# file flag.zip 
flag.zip: Zip archive data, at least v2.0 to extract
root@kali:~/CTF/riftCTF2020/Forensics/Forensics_0x0003# unzip flag.zip 
Archive:  flag.zip
[flag.zip] readme.txt password: 
   skipping: readme.txt              incorrect password
   skipping: flag.txt                incorrect password

この後johnを試してみたが解ける気配なし。
zipと言えば既知平文攻撃もあるが、「readme.txt」の中身は分からない。
唯一の手がかりは

# strings flag.zip | tail
readme.txt
)CqS8W
spP_BRT6
flag.txt
a`nNyi
_BRT6
readme.txt
spP_BRT6
flag.txt
LOL YOU CANT READ THE FLAG LOLLOLOLOLOLOLOLOLOLOLOLOLOLOLO

分からん。

Forensics 0x0004

Forensics 0x0004
100
EASY
1.this is one of those challenges where you can't solve it until and unless you recognize the stuff.
2.flag format ritsCTF{<---flag-here--->}.
3.Good Luck.
author-- X3eRo0

与えられたファイル「razorgirl.mp3」について

# file razorgirl.mp3 
razorgirl.mp3: Audio file with ID3 version 2.3.0, contains:MPEG ADTS, layer III, v1, 128 kbps, 48 kHz, JntStereo
# mpv razorgirl.mp3 
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
A: 00:05:01 / 00:05:01 (99%)


Exiting... (End of file)

とりあえず聞いてみたところよく分からん音楽が聞こえている。
と思いきや急に3分10秒あたりからSSTVぽいのが流れてくる。
急すぎて笑ってしまった。

f:id:Zarat:20200501195510p:plain
急に始まるSSTV、RX-SSTVにて
flag: ritftCTF{-y0ur-sk1llz-4r#-31337}
flagがめちゃくちゃ。

Time Problems - Securinets CTF Quals 2020 Forensics writeup

最近急に教育コンテンツが充実したことで、無限の目移りを繰り返す日々を繰り返す。
引き続き、2020/03/22 2:00 - 03/32 2:00 JSTに行われた 「Securinets CTF Quals 2020」の「Time Problems」をお届け。

前回↓
Time matters - Securinets CTF Quals 2020 Forensics writeup - 4ensiX

Time Problems

More magic on this one too :)

なあ、このCTFもうちょいヒントあっても良くないか。
といったところで与えられたファイル「for2.zip」に関して。

# file for2.zip 
for2.zip: Zip archive data, at least v2.0 to extract
# unzip for2.zip 
Archive:  for2.zip
  inflating: for2.raw                
# file for2.raw 
for2.raw: ELF 64-bit LSB core file, x86-64, version 1 (SYSV)

メモリダンプぽいのでvolatilityを利用。

# volatility -f for2.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_Problems/for2.raw)
                      PAE type : PAE
                           DTB : 0x185000L
                          KDBG : 0x8273fb78L
          Number of Processors : 1
     Image Type (Service Pack) : 1
                KPCR for CPU 0 : 0x80b96000L
             KUSER_SHARED_DATA : 0xffdf0000L
           Image date and time : 2020-03-20 11:58:05 UTC+0000
     Image local date and time : 2020-03-20 12:58:05 +0100

profileは、Win7SP1x86で問題無いと判断。

# volatility --profile=Win7SP1x86 -f for2.raw pstree
Volatility Foundation Volatility Framework 2.6
Name                                                  Pid   PPid   Thds   Hnds Time
-------------------------------------------------- ------ ------ ------ ------ ----
 0x83a1ab10:wininit.exe                               388    344      3     76 2020-03-20 11:55:31 UTC+0000
. 0x853f5638:services.exe                             480    388      9    196 2020-03-20 11:55:31 UTC+0000
.. 0x83bf3a40:WmiApSrv.exe                           3308    480      7    116 2020-03-20 11:57:11 UTC+0000
.. 0x84c43d20:spoolsv.exe                            1304    480     17    301 2020-03-20 11:55:33 UTC+0000
.. 0x8557f030:VBoxService.ex                          664    480     14    127 2020-03-20 11:55:32 UTC+0000
.. 0x855a2c68:svchost.exe                             772    480     21    454 2020-03-20 11:55:32 UTC+0000
... 0x856062e0:audiodg.exe                           1028    772      5    115 2020-03-20 11:55:33 UTC+0000
.. 0x85634a48:svchost.exe                            1184    480     19    385 2020-03-20 11:55:33 UTC+0000
.. 0x855f7030:svchost.exe                             932    480     16    302 2020-03-20 11:55:33 UTC+0000
.. 0x8560d778:svchost.exe                            1064    480      5    115 2020-03-20 11:55:33 UTC+0000
.. 0x847c2b70:taskhost.exe                           1456    480     10    186 2020-03-20 11:55:34 UTC+0000
.. 0x849b9498:SearchIndexer.                          856    480     14    591 2020-03-20 11:55:41 UTC+0000
.. 0x83af9d20:mscorsvw.exe                           3680    480      6     78 2020-03-20 11:57:42 UTC+0000
.. 0x83bf7d20:sppsvc.exe                             3808    480      6    151 2020-03-20 11:57:43 UTC+0000
.. 0x84d58b00:svchost.exe                            1352    480     21    314 2020-03-20 11:55:33 UTC+0000
.. 0x855ff030:svchost.exe                             976    480     39    947 2020-03-20 11:55:33 UTC+0000
... 0x8488c4c8:taskeng.exe                           1776    976      6     83 2020-03-20 11:55:34 UTC+0000
.. 0x8481e030:svchost.exe                            1620    480     15    229 2020-03-20 11:55:34 UTC+0000
.. 0x8555f8b8:svchost.exe                             600    480     11    357 2020-03-20 11:55:32 UTC+0000
... 0x84874100:WmiPrvSE.exe                          3160    600     15    323 2020-03-20 11:57:08 UTC+0000
... 0x83b50030:WmiPrvSE.exe                          2724    600      9    148 2020-03-20 11:56:59 UTC+0000
.. 0x8558e250:svchost.exe                             720    480      7    259 2020-03-20 11:55:32 UTC+0000
.. 0x855d73e8:svchost.exe                             876    480     21    443 2020-03-20 11:55:32 UTC+0000
... 0x847d28c8:dwm.exe                               1528    876      4     75 2020-03-20 11:55:34 UTC+0000
. 0x854fa030:lsass.exe                                488    388      7    501 2020-03-20 11:55:31 UTC+0000
. 0x85501550:lsm.exe                                  496    388     10    151 2020-03-20 11:55:31 UTC+0000
 0x84abc030:csrss.exe                                 352    344      8    397 2020-03-20 11:55:31 UTC+0000
 0x83a1a308:csrss.exe                                 396    380      8    307 2020-03-20 11:55:31 UTC+0000
 0x84a37d20:winlogon.exe                              436    380      4    113 2020-03-20 11:55:31 UTC+0000
 0x847e09f8:explorer.exe                             1568   1520     22    670 2020-03-20 11:55:34 UTC+0000
. 0x8493bd20:chrome.exe                              2320   1568     34    894 2020-03-20 11:56:56 UTC+0000
.. 0x83b6dd20:chrome.exe                             2716   2320     11    200 2020-03-20 11:56:59 UTC+0000
.. 0x8bdfe960:chrome.exe                             3364   2320     15    296 2020-03-20 11:57:13 UTC+0000
.. 0x84853488:chrome.exe                             2496   2320     17    324 2020-03-20 11:56:57 UTC+0000
.. 0x85424d20:chrome.exe                             3344   2320     12    176 2020-03-20 11:57:12 UTC+0000
.. 0x8553d030:chrome.exe                             3300   2320     16    245 2020-03-20 11:57:11 UTC+0000
.. 0x849865c8:chrome.exe                             2352   2320      9     76 2020-03-20 11:56:56 UTC+0000
.. 0x84852590:chrome.exe                             2384   2320      3     55 2020-03-20 11:56:57 UTC+0000
.. 0x8554fc70:chrome.exe                             3196   2320     14    309 2020-03-20 11:57:09 UTC+0000
. 0x8490b030:VBoxTray.exe                            2036   1568     14    138 2020-03-20 11:55:35 UTC+0000
 0x839af9d0:System                                      4      0     82    507 2020-03-20 11:55:28 UTC+0000
. 0x848f6438:smss.exe                                 276      4      2     29 2020-03-20 11:55:28 UTC+0000

こりゃまた微妙なの来たな。どうすればいいのだろうか。とりあえずmimikatzしたが......

# volatility --profile=Win7SP1x86 -f for2.raw mimikatz
Volatility Foundation Volatility Framework 2.6
Module   User             Domain           Password                                
-------- ---------------- ---------------- ----------------------------------------
wdigest  home             home-PC                                                  
wdigest  HOME-PC$         WORKGROUP                                  

結果は御覧のあり様。
Time Matters」と同じようにchromeの履歴から探っていくことに。

# volatility --profile=Win7SP1x86 -f for2.raw filescan | grep "History"
Volatility Foundation Volatility Framework 2.6
0x000000001e3d5f80      5      1 RW-rw- \Device\HarddiskVolume2\Users\home\AppData\Local\Google\Chrome\User Data\Default\History
0x000000001ec096a8     17      1 RW-rw- \Device\HarddiskVolume2\Users\home\AppData\Local\Google\Chrome\User Data\Default\History-journal
# volatility --profile=Win7SP1x86 -f for2.raw dumpfiles -Q 0x000000001e3d5f80 -D ./
Volatility Foundation Volatility Framework 2.6
DataSectionObject 0x1e3d5f80   None   \Device\HarddiskVolume2\Users\home\AppData\Local\Google\Chrome\User Data\Default\History
SharedCacheMap 0x1e3d5f80   None   \Device\HarddiskVolume2\Users\home\AppData\Local\Google\Chrome\User Data\Default\History
# mv file.None.0x84a3f558.dat History
root@kali:~/CTF/SecurinetsCTF2020/For/Time_Problems# strings History | less
(snip)
neymar santosneymar santos!
corona neymarcorona neymar
corona italycorona italy#
corona tunisiecorona tunisie
corona mapcorona map+
        neymar best skillsneymar best skills'
neymar instagramneymar instagram
neymarneymar
https://www.youtube.com/watch?v=wQoVjMMYWJ4
https://twitter.com/neymarjr/status/1217902956475047937
https://www.youtube.com/watch?v=BPi3ePVFRik
https://www.youtube.com/results?search_query=neymar+santos
http://52.205.164.112/
(snip)
https://www.google.com/search?q=neymar&oq=neymar&aqs=chrome..69i57j46j0l6.1797j0j7&sourceid=chrome&ie=UTF-8
https://www.youtube.com/results?search_query=neymar+santosneymar santos - YouTube
https://www.youtube.com/watch?v=BPi3ePVFRikNeymar JR 
 Ultimate Skills 2013 - Part 01 
 Santos | HD - YouTube
http://52.205.164.112/

何か「http[:]//52.205.164.112/」という怪しいサイトへ接続してる。てか、neymar大好きですね。
じゃあ見てみるか。

# ping 52.205.164.112
PING 52.205.164.112 (52.205.164.112) 56(84) bytes of data.
^C
--- 52.205.164.112 ping statistics ---
23 packets transmitted, 0 received, 100% packet loss, time 22857ms

残念。希望を持ってwebアーカイブで探してみよう。
色々見ているとここが優秀と聞きまして↓
http://timetravel.mementoweb.org/list/20090108113335/http://52.205.164.112
ちゃんと引っかかってくれたので、この業界では信頼のアツいwaybackmachineの方のリンクへ行くと。

f:id:Zarat:20200421221110p:plain
https://web.archive.org/web/20200318121831/http://52.205.164.112/
左下にflagぽいものが、

Securinets{█████_1s_my_f4vorit3_Pl4yer}

そんなの知るかぁと思ったが、検索履歴にneymar多めだったな。とうことで。
flag: Securinets{neymar_1s_my_f4vorit3_Pl4yer}

Unicode的には5文字だったけど、実際は6文字だったようで。

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」をお届け。

ctftime.org

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

一応確認すると、

f:id:Zarat:20200421210939p:plain
出てきたJPEG
これはメッシである。
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

f:id:Zarat:20200421211621p:plain
正解は「Messi2019」
flag: Securinets {c7e2723752111ed983249627a3d752d6}


忍耐と勘の問題だった。

Little - SuSeC CTF 2020 Forensics writeup

Autopsyの無料トレーニングを終えていい気分でいたものの、書いておきたいwriteupが貯まりに溜まりまくってるこの頃。
今回は、2020/03/15 15:30 ~ 2020/03/17 03:30 (JST) に行われた「SuSeC CTF 2020」の「Little」をお届けする。

ctftime.org

Little

A little boy is playing around in his grandfather's attic, where he finds a magical box. Help him discover what is in the box.

ATTENTION: The flag that you are going to capture for this task does not contain the word SUSEC{, but you have to add this word to the beginning of the discovered flag before submitting it.

与えられたファイル「little.img_03551d5d361ae5f58675f065da899e9f6e9e3361.txz」を見ていく。

# file little.img_03551d5d361ae5f58675f065da899e9f6e9e3361.txz 
little.img_03551d5d361ae5f58675f065da899e9f6e9e3361.txz: XZ compressed data
# rm little.img
# tar -Jxvf little.img_03551d5d361ae5f58675f065da899e9f6e9e3361.txz 
little.img
# file little.img
little.img: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 4, reserved sectors 2048, root entries 512, sectors 8192 (volumes <=32 MB), Media descriptor 0xf8, sectors/FAT 5, sectors/track 32, heads 64, serial number 0xe318769f, unlabeled, FAT (12 bit)

ディスクイメージのようなので、sleuth kit で見ていく。

# img_stat little.img
IMAGE FILE INFORMATION
--------------------------------------------
Image Type: raw

Size in bytes: 67108864
Sector size:    512
# mmls little.img
Cannot determine partition type
# fsstat -i raw little.img
Cannot determine file system type (EXT2/3/4 or FAT)

sleuth kitさんがおっしゃるには、「これ、EXT2/3/4かFATじゃね」ということ。とりあえず、EXTで見てみる。

# fls -i raw -f ext little.img
-/r 25: secondf.png
V/V 49: $OrphanFiles
# icat -i raw -f ext little.img 25 > secondf.png
# file secondf.png 
secondf.png: PNG image data, 1024 x 300, 8-bit/color RGB, non-interlaced

「secondf.png」というファイルが出てきましたね。secondということは、何か手順を飛ばした?
このpngを見てみるとflagのようなものが書いてあるが、

f:id:Zarat:20200417034253p:plain
secondf.png
「tO_7h3_3nd_Of」となっており、中途半端なので「firstf」と「thirdf」がありそう。
次は「FAT」で見てみる。

# fls -i raw -f fat little.img
r/r 3:    FIRSTF.KGB
v/v 98147:    $MBR
v/v 98148:    $FAT1
v/v 98149:    $FAT2
V/V 98150:    $OrphanFiles
# icat -i raw -f fat little.img 3 > FIRSTF.KGB
# file FIRSTF.KGB
FIRSTF.KGB: KGB Archiver file with compression level 3

「FIRSTF.KGB」と、おそらくflagの始めの部分ぽいものを発見した。
ここで、kgbとは wiki
KGB Archiver - Wikipedia
圧縮?ファイルということで、7-zipを試す。

# 7za x FIRSTF.KGB

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=ja_JP.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (806E9),ASM,AES-NI)

Scanning the drive for archives:
1 file, 196401 bytes (192 KiB)

Extracting archive: FIRSTF.KGB
ERROR: FIRSTF.KGB
Can not open the file as archive


Can't open as archive: 1
Files: 0
Size:       0
Compressed: 0

あの7-zipが対応していないなんてあるのかと思いつつ、これはおそらく知識の不足で勘違いな部分もあると思うので深く言及しない。
kgbアーカイバが必要なようなので、導入して利用。

# kgb FIRSTF.KGB
Extracting archive KGB_arch -3 FIRSTF.KGB ...
       191KB firstf.ogg: equal
191KB -> 191KB w 0.54s. (99.99% czas: 363 KB/s)
# file firstf.ogg
firstf.ogg: Ogg data, Opus audio,
# mpv firstf.ogg
 (+) Audio --aid=1 (opus 1ch 48000Hz)
AO: [pulse] 48000Hz mono 1ch float
A: 00:00:24 / 00:00:24 (98%)


Exiting... (End of file)

kgbからは「firstf.ogg」が出てきて、この音声ファイルをとりあえず再生してみると「c0me_wi4h_f4t_m4n_」とflagが聞こえてきた。
お次は、「thirdf」だが。ここまで、mmlsパーティションが確認できなかったにも関わらずsleuth kitのお声に従うと「EXT」と「FAT」があった。何となく、「thirdf」も同じようにありそうな気がしつつ、何か手がかりが無いかと思いつつ、stringsで探索する。

# strings little.img | grep "thirdf"
thirdf.mp4
thirdf.mp4

目的の「thirdf」は、「thirdf.mp4」として存在しているらしい。
さあ、ここからどうするかと「 Forensics toolのまとめ(windows多め)最終更新2020/04/06 - 4ensiX」を 眺めていると、「testdisk」が目に入ったので利用する。

# testdisk little.img

最初に[Proseed] を選択、パーティションは分からなかったので [None] 、 そして次のところでqを押して[Analyze]を選択する。[Quick Search] -> Enter(ext2のやつを選択) -> [Deeper Search]すると、三つのパーティションが現れる。

f:id:Zarat:20200417035644p:plain
testdiskで出てきた3つのパーティション
いや、パーティションて書いてあるけど何でsleuth kit で出てこないんやと思ったのは自分だけではないハズ(分からん)。
とりあえず、「P」で各々のパーティションのファイルを見てみると、
f:id:Zarat:20200417040008p:plain
一つ目のパーティション
f:id:Zarat:20200417040054p:plain
二つ目のパーティション
f:id:Zarat:20200417040154p:plain
三つ目のパーティション
三つ目だけ、何も出てこない。おそらく、ここに「thirdf.mp4」がありそうな気がする。
何となく、上手くファイルカービングする必要があるのだろうけれど、どうすればいいか。と思いつつ、ファイル修復屋さんの「photorec」に助けを求めてみる。

# photorec little.img

[Proceed] を選択してから、「Unknown」と「ext2」が見える。ここは、先のtestdiskの結果から「ext2」で見れば「thirdf.mp4」に出会えそうな気がするので「ext2」を選択。「Free」と「Whole」の選択があるがどうすればいいか分からない。

f:id:Zarat:20200417042315p:plain
photorec解析
「thirdf.mp4」が未割当なのかどうか分からない。でも、そもそも認識されていないなら未割当と考えていいのだろうか。とりあえず、「Free」でやってみる。
選択後に、出力したいディレクトリ内で「C」を選択すると出てくる。
「photorec」が頑張ってカービングした結果が、選択したディレクトリ内のrecup_dir*という名前のディレクトリに出力される。

~/recup_dir.1# ls
f0000000.fat  f0008432.mp4  report.xml

まず、出てきた「f0000000.fat」は、binwalkに通すことで、

# binwalk f0000000.fat 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
519168        0x7EC00         KGB archive

kgbアーカイブが含まれることを確認した。これたぶん「FIRSTF.KGB」だと思われる。
また、「f0008432.mp4」を再生したところ。

# mpv f0008432.mp4 
 (+) Video --vid=1 (*) (h264 1400x188 15.000fps)
VO: [gpu] 1400x188 yuv444p
V: 00:00:08 / 00:00:08 (99%) Dropped: 1


Exiting... (End of file)

f:id:Zarat:20200417220035p:plain
「f0008432.mp4」の再生の様子
↑図のように、flagの最後の部分が入力されるのを確認した。

flag: SUSEC{c0me_wi4h_f4t_m4n_t0_7he_3nd_0f_t4i3_sUsEc_journey}

追想

binwalkからのアプローチ

他の方のやり方を見ると、始めのアプローチとしてbinwalkを利用するケースが見られた。しかし、自分の環境とその人の環境では何が違うのか分からないが表示結果が違った。

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Linux EXT filesystem, rev 1.0, ext2 filesystem data, UUID=e0676215-9cc7-abbd-f840-953aacffacff
1160          0x488           Unix path: /home/susec/yoursearching/name_is/junk
279112        0x44248         Unix path: /home/susec/yoursearching/name_is/littleBoy.img
524288        0x80000         Linux EXT filesystem, rev 1.0, ext2 filesystem data, UUID=e0676215-9cc7-abbd-f840-953aacffacff
532480        0x82000         PNG image, 1024 x 300, 8-bit/color RGB, non-interlaced
532754        0x82112         Unix path: /www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:dc="http://
535150        0x82A6E         Zlib compressed data, default compression
1072128       0x105C00        KGB archive
66601544      0x3F84248       Unix path: /home/susec/yoursearching/name_is/littleBoy.img
66863688      0x3FC4248       Unix path: /home/susec/yoursearching/name_is/littleBoy.img

ここまで、binwalkで辿り着けるらしい。

「thirdf.mp4」の別方法?のカービング

autopsy(使用ver.4.14.0)で、「litlle.img」を開くと、「$Carvedfile」に「f0008432.mp4」を確認した。
このとき「little.img」は、データソースのタイプとして「未使用領域のイメージファイル(Unallocated)」として読み込み、「インジェストモジュール(injest module)」の「PhotoRec Carver」の利用を忘れない。

f:id:Zarat:20200417222322p:plain
autopsyで「little.img」を開いてみた
サムネの大きさを大(Large)にしたら、flagが見える。
f:id:Zarat:20200417222527p:plain
サムネでflagが見えた
結局、photorecの力を借りてるけどね。sleuth kit でもできないもんかね。