picoCTF 2022 writeup[forensics]

ファイルシステム解析系

Sleuthkit Intro (100pts)

$ mmls disk.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   0000204799   0000202752   Linux (0x83)

より、lengthは202752です。
picoCTF{mm15_f7w!}

Sleuthkit Apprentice (200pts)

fls -r -o 2048 disk.flag.img > dirs.outをするとimage内のファイルの一覧が出てくるので、じっと眺めます。すると、

...
d/d 1995:	root
+ r/r 2363:	.ash_history
+ d/d 3981:	my_folder
++ r/r * 2082(realloc):	flag.txt
++ r/r 2371:	flag.uni.txt
...

/root/my_folder/flag.uni.txtとかいう怪しいファイルがあるので取ってくると勝ちです。

$ 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   0000360447   0000153600   Linux Swap / Solaris x86 (0x82)
004:  000:002   0000360448   0000614399   0000253952   Linux (0x83)

$ icat -o 360448 disk.flag.img 2371
picoCTF{by73_5urf3r_42028120}

Operation Oni (300pts)

問題文的に、sshの秘密鍵を見つければよいです。fls -r -o 206848 disk.img > dirs.outをして眺めていると、

d/d 470:	root
+ r/r 2344:	.ash_history
+ d/d 3916:	.ssh
++ r/r 2345:	id_ed25519
++ r/r 2346:	id_ed25519.pub

rootの下に/root/.ssh/id_ed25519という秘密鍵/公開鍵ペアが見えます。これを取ってくると勝ちです。

picoCTF{k3y_5l3u7h_af277f77}

Operation Orchid (400pts)

fls -r -o 206848 disk.img > dirs.outをして眺めていると、

d/d 472:	root
+ r/r 1875:	.ash_history
+ r/r * 1876(realloc):	flag.txt
+ r/r 1782:	flag.txt.enc

rootの下に暗号化されたっぽいflagが見えます。また、.ash_historyを見てみると

...
openssl
openssl aes256 -salt -in flag.txt -out flag.txt.enc -k unbreakablepassword1234567
shred -u flag.txt
ls -al
halt

と書いてあるので、復号するときはopenssl aes256 -salt -d -in flag.txt.enc -out flag.txt.dec -k unbreakablepassword1234567とすればよいことがわかります。

picoCTF{h4un71ng_p457_17237fce}

pcap解析系

Packets Primer (100pts)

渡されたpcapファイルをwiresharkで見ると、4番目のTCPパケットにflagが書いてあります。
picoCTF{p4ck37_5h4rk_7d32b1de}

Eavesdrop (300pts)

渡されたpcapファイルをwiresharkで見ると、No.18のパケットでファイルがopenssl des3 -d -salt -in salted.bin -out i.txt -k supersecretpassword123というコマンドで復号できることがわかります。また、No.57ではsaltedされたデータが送られているのでこれをエクスポートし、復号すればよいです。
picoCTF{nc_73115_411_77b05957}

Torrent Analyze (400pts)

https://moririn-web.blogspot.com/2009/04/bep-5.htmlhttps://ipv6.torrent.ubuntu.com/ をみていると、torrentではファイルにinfo_hashという情報が付与されていることがわかります。
wiresharkで"info_hash"で検索するとinfo_hash20:[16進hash]e1:q9:のようなバイナリが何個か見えますが、このうちよく出現しているe2467cbf021192c241367b892230dc1e05c0580eが求めるファイルのinfo_hashであると推測できます。
あとは、「bittorrent e2467cbf021192c241367b892230dc1e05c0580e」とかで検索してみると https://linuxtracker.org/index.php?page=torrent-details&id=e2467cbf021192c241367b892230dc1e05c0580e のようなサイトから求めるファイルの名前がubuntu-19.10-desktop-amd64.isoであることがわかります。
picoCTF{ubuntu-19.10-desktop-amd64.iso}

その他

Enhance! (100pts)

SVGファイルの中身をテキストとして読むとflagが見えます。
picoCTF{3nh4nc3d_58bd3420}

File types (100pts)

超めんどいです。渡されたファイルはいろんな圧縮形式で圧縮されまくったファイルになっているので、がんばって解凍しまくります。

$ ./Flag.pdf 
x - created lock directory _sh00047.
x - extracting flag (text)
x - removed lock directory _sh00047.
$ file flag
flag: current ar archive
$ ar p ./flag > flag2
$ file flag2
flag2: cpio archive
$ cpio -iv < ./flag2
flag
2 blocks
$ file flag
flag: bzip2 compressed data, block size = 900k
$ bunzip2 flag
bunzip2: Can't guess original name for flag -- using flag.out
$ file flag.out
flag.out: gzip compressed data, was "flag", last modified: Tue Mar 15 06:50:46 2022, from Unix
$ gunzip -c flag.out > flag3
$ file flag3
flag3: lzip compressed data, version: 1
$ lzip -d flag3
$ file flag3.out
flag3.out: LZ4 compressed data (v1.4+)
$ lz4 -d ./flag3.out flag4
Successfully decoded 266 bytes
$ lzcat ./flag4 > flag5
$ mv flag5 flag5.lzo
$ lzop -d flag5.lzo 
$ file flag5
flag5: lzip compressed data, version: 1
$ mv flag5 flag5.lz
$ lzip -d flag5.lz 
$ file flag5
flag5: XZ compressed data
$ mv flag5 flag5.xz
$ xz -d flag5.xz
$ cat flag5
7069636f4354467b66316c656e406d335f6d406e3170756c407431306e5f
6630725f3062326375723137795f35613833373565307d0a

picoCTF{f1len@m3_m@n1pul@t10n_f0r_0b2cur17y_5a8375e0}

Lookey here (100pts)

cat anthem.flag.txt | grep picoするだけ。
picoCTF{gr3p_15_@w3s0m3_429334b2}

Redaction gone wrong (100pts)

pdfの黒塗りを貫通してコピーできてしまうやつです。
picoCTF{C4n_Y0u_S33_m3_fully}

St3g0 (300pts)

zstegに投げて祈りました。

$ zsteg -a ./pico.flag.png 
b1,rgb,lsb,xy       .. text: "picoCTF{7h3r3_15_n0_5p00n_87ef5b0b}$t3g0"

SideChannel (400pts)

Timing attackをする問題です。
echo ######## | time ./pin_checkerで実行時間を計測すると、いれたPINの上の方の桁がが正しいPINと当たっているときだけ実行時間がちょっとだけ長くなることがわかります。よって大きい桁から順に実行時間がちょっと長くなる数字を探索して行けばよいです。
ただしいPINは48390513でした。
picoCTF{t1m1ng_4tt4ck_0431e830}