2021年3月16日~3月30日(日本時間では3月17日~3月31日)に開催された中高生向けのCTF大会、picoCTFの[General Skills]分野のwriteupです。
その他のジャンルについてはこちらを参照
Obedient Cat
This file has a flag in plain sight (aka "in-the-clear").
Download flag.というリンクがあるので踏んでみます。
flagという拡張子なしのファイルが落ちてくるので、lessコマンドで中身を確認。
$ less flag
picoCTF{s4n1ty_v3r1f13d_2aa22101}
Python Wrangling
Python scripts are invoked kind of like programs in the Terminal... Can you run this Python script using this password to get the flag?
ende.py, flag.txt.en, pw.txt が配布されます。実行すればいいだけのようなので、ende.pyの冒頭にあるとおりに実行してみます。
$ python ende.py -d flag.txt.en
Please enter the password:67c6cc9667c6cc9667c6cc9667c6cc96
picoCTF{4p0110_1n_7h3_h0us3_67c6cc96}
Wave a flag
Can you invoke help flags for a tool or binary? This program has extraordinarily helpful information...
warmというファイルが配布されます。
$ file warm warm: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=3aa19b2a9cc4e093d64025eab8f510679b523455, with debug_info, not stripped
実行ファイルだ。Macで作業してて、Linux VM立ち上げるのも面倒なので、stringsでbinaryファイルの文字列を抽出してもらう。
$ strings warm | grep pico
Oh, help? I actually don't do much, but I do have this flag here: picoCTF{b1scu1ts_4nd_gr4vy_30e77291}
Nice netcat...
There is a nice program that you can talk to by using this command in a shell:
$ nc mercury.picoctf.net 35652, but it doesn't speak English...
とりあえず言われたとおりに接続してみます。
$ nc mercury.picoctf.net 35652 112 105 99 111 67 84 70 123 103 48 48 100 95 107 49 116 116 121 33 95 110 49 99 51 95 107 49 116 116 121 33 95 57 98 51 98 55 51 57 50 125 10
なんか数字が振ってきた。最後の方に125(10進数の })があるので、10進数 -> ascii変換をすれば良さそう。
CyberChefで Froom Decimal をするとflagになった。

Static ain't always noise
Can you look at the data in this binary: static? This BASH script might help!
実行ファイル static と、ltdis.sh が配布されます。
多分想定解は
$ ./ltdis.sh static
なんだろうけど、stringsコマンドででてきてしまった。
$ strings static | grep pico
picoCTF{d15a5m_t34s3r_f6c48608}
Tab, Tab, Attack
Using tabcomplete in the Terminal will add years to your life, esp. when dealing with long rambling directory structures and filenames: Addadshashanammu.zip
Addadshashanammu.zip が配布されるので回答してみると、結構階層が深いところにexeファイルが出現。階層をたどって、exeファイルをstringsしてみた。
$ unzip Addadshashanammu.zip
Archive: Addadshashanammu.zip
creating: Addadshashanammu/
creating: Addadshashanammu/Almurbalarammi/
creating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/
creating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/
creating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/Maelkashishi/
creating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/Maelkashishi/Onnissiralis/
creating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/Maelkashishi/Onnissiralis/Ularradallaku/
inflating: Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/Maelkashishi/Onnissiralis/Ularradallaku/fang-of-haynekhtnamet
$ cd Addadshashanammu/Almurbalarammi/Ashalmimilkala/Assurnabitashpi/Maelkashishi/Onnissiralis/Ularradallaku/
$ strings fang-of-haynekhtnamet | grep pico
*ZAP!* picoCTF{l3v3l_up!_t4k3_4_r35t!_76266e38}
Magikarp Ground Mission
Do you know how to move between directories and read files in the shell? Start the container,
sshto it, and thenlsonce connected to begin. Login viasshasctf-playerwith the password,xxxxxx

おや、初めての形式だ。containerを立ち上げて、そこにsshで入ってみるという問題かな。この緑のボタンをポチッとしてみる。
暫く待つとlaunchされたようで、接続先の情報が出てきた。

launch中にsshコマンド作っておいたのに、コマンドまで用意してくれてる。親切!
まずは接続。
$ ssh ctf-player@venus.picoctf.net -p 49964 The authenticity of host '[venus.picoctf.net]:49964 ([3.131.124.143]:49964)' can't be established. ECDSA key fingerprint is SHA256:NrQkIxNEQQho/GA7jE0WlIa7Jh4VF9sAvC5awkbuj1Q. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
初めての接続だと聞かれるので yes.
Warning: Permanently added '[venus.picoctf.net]:49964,[3.131.124.143]:49964' (ECDSA) to the list of known hosts. ctf-player@venus.picoctf.net's password:
問題文にあるpasswordを入力すると、繋がりました!
まずはlsせよとのことだったのでやってみます。で、見つかったファイルを表示し、司令が書いてある場合はその指令に従ってあっちこっち行き来するとflagが集まりました。
ctf-player@pico-chall$ ls
1of3.flag.txt instructions-to-2of3.txt
ctf-player@pico-chall$ cat 1of3.flag.txt
picoCTF{xxsh_
ctf-player@pico-chall$ cat instructions-to-2of3.txt
Next, go to the root of all things, more succinctly `/`
ctf-player@pico-chall$ cd /
ctf-player@pico-chall$ ls
2of3.flag.txt dev instructions-to-3of3.txt media proc sbin tmp
bin etc lib mnt root srv usr
boot home lib64 opt run sys var
ctf-player@pico-chall$ cat 2of3.flag.txt
0ut_0f_\/\/4t3r_
ctf-player@pico-chall$ cat instructions-to-3of3.txt
Lastly, ctf-player, go home... more succinctly `~`
ctf-player@pico-chall$ cd ~
ctf-player@pico-chall$ ls
3of3.flag.txt drop-in
ctf-player@pico-chall$ cat 3of3.flag.txt
c1754242}
ctf-player@pico-chall$ exit
generalはこれでおしまい。