4ensiX

4ensiX

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

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がめちゃくちゃ。