picoCTF 2022 Operation Orchid writeup
コンテスト中に解けなかった問題の復習です。
問題文
Download this disk image and find the flag. Note: if you are using the webshell, download and extract the disk image into /tmp not your home directory. * Download compressed disk image
リンクから disk.flag.img.gz
がダンロードできる。
ヒント
なし
解法
まずは、ファイルを展開する。
# gunzip disk.flag.img.gz # ls disk.flag.img
sleuthkit を使って、探し出す。全体を、mmlsで確認。
# mmls disk.flag.img 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 0000002047 0000002048 Unallocated 002: 000:000 0000002048 0000206847 0000204800 Linux (0x83) 003: 000:001 0000206848 0000411647 0000204800 Linux Swap / Solaris x86 (0x82) 004: 000:002 0000411648 0000819199 0000407552 Linux (0x83)
構成的には、 Sleuthkit Apprentice と同じようだった。 /root/flag.txt.enc
がすぐに見つかる。
fcat -o 0000411648 /root/flag.txt.enc disk.flag.img
すると、 Salted__
から始まる文字列がある。はて、どうしたものか。
picoCTF2022 [Forensics] writeup - 好奇心の足跡 を読む。 なるほど、 .ash_history
も関係があるのか。
/root/
のディレクトリには、
# fls -o 0000411648 disk.flag.img 472 r/r 1875: .ash_history r/r * 1876(realloc): flag.txt r/r 1782: flag.txt.enc
があり、 .ash_history
を覗いてみると・・・
# fcat -o 0000411648 /root/.ash_history disk.flag.img touch flag.txt nano flag.txt apk get nano apk --help apk add nano nano flag.txt openssl openssl aes256 -salt -in flag.txt -out flag.txt.enc -k unbreakablepassword1234567 shred -u flag.txt ls -al halt
となっている。 flag.txt.enc
を利用して、decodeして戻してあげれば良さそう。
# fcat -o 0000411648 /root/flag.txt.enc disk.flag.img > flag.txt.enc # openssl aes256 -d -salt -in flag.txt.enc -out flag.txt -k unbreakablepassword1234567 *** WARNING : deprecated key derivation used. Using -iter or -pbkdf2 would be better. bad decrypt 139926876464448:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:610:
エラーが出たけど、
# cat flag.txt picoCTF{h4un71ng_p457_1d02081e}
が得られた。