Port 53

明日のための技術メモ

picoCTF2019 General Skills WriteUP

picoCTF2019の通年大会がオープンしたので、
解いた順に記録していきます。
factory's secretはほぼ脱出ゲーム的な感じだったのでパス。
解いたけど。

General Skills

Let's Warm Up (50pt)

16進数で0x70をASCIIにすると何か? 変換表で確認すると、pなのが分かる。

picoCTF{p}

Warmed Up (50pt)

16進数0x3Dを10進数に直せ 変換ツール等を使って、答えは61

picoCTF{61}

2Warm (50pt)

10進数42を2進数に直せ 変換ツール等を使うか自分で計算して、答えは101010

picoCTF{101010}

Bases (100pt)

bDNhcm5fdGgzX3IwcDM1をデコードしろ、Baseに関係ある。
CyberChefでBase64デコードをかけると、l3arn_th3_r0p35になる。

picoCTF{l3arn_th3_r0p35}

First Grep (100pt)

ファイルの中にフラグがあるのでGrepして探せ

~/Downloads $ cat file | grep picoCTF{
picoCTF{grep_is_good_to_find_things_eda8911c}

Resources (100pt)

困ったらここを見てね、というページを宣伝しているだけ。
このページを見るとフラグが書いてあった。
picoctf.com

picoCTF{r3source_pag3_f1ag}

Strings (100pt)

stringsというファイルを実行させずに、中にあるフラグを探せ 素直にstringsコマンドを使って、grepする

~/Downloads $ strings strings | grep picoCTF
picoCTF{5tRIng5_1T_827aee91}

what's a net cat? (100pt)

netcatコマンドの使い方チュートリアル
picoCTFのサーバにポート49816でスキャンしろとのこと

~/Downloads $ nc 2019shell1.picoctf.com 49816
You're on your way to becoming the net cat master
picoCTF{nEtCat_Mast3ry_a752a0d3}

Base (200pt)

これ2018にも出てた。what base is this? (200pt)を参照。
使ったコードはこちらの該当問題を見てください。
port53.hatenablog.com

サーバに繋ぐと、2進数->8進数->16進数をそれぞれ文字に
変換する問題。去年のと順番が違うけど、コードは使えるので、
それを実行しながら答えを出した。 去年30秒以内で解答だったのに、今年45秒になってる。優しい。

~/Downloads $ nc 2019shell1.picoctf.com 20836
Let us see how data is stored
test
Please give the 01110100 01100101 01110011 01110100 as a word.
...
you have 45 seconds.....

Input:
test
Please give me the  154 151 155 145 as a word.
Input:
lime
Please give me the 6f76656e as a word.
Input:
oven
You've beaten the challenge
Flag: picoCTF{learning_about_converting_values_6cdcad0d}

First Grep: Part2 (200pt)

指定されたディレクトリにある大量のフォルダ内にある大量のファイルに
フラグが隠れているので、grepを使って見つける。
find, grep, xargsを使うとワンライナーでいける

saturnglave@pico-2019-shell1:/problems/first-grep--part-ii_6_84224d7d745e41d24bde7e7bc70
62bbe/files$ find ./files* -name "file*" | xargs grep picoCTF
grep: ./files0: Is a directory
grep: ./files1: Is a directory
grep: ./files10: Is a directory
grep: ./files2: Is a directory
./files2/file24:picoCTF{grep_r_to_find_this_5241c61f}
grep: ./files3: Is a directory
grep: ./files4: Is a directory
grep: ./files5: Is a directory
grep: ./files6: Is a directory
grep: ./files7: Is a directory
grep: ./files8: Is a directory
grep: ./files9: Is a directory

plumbing (200pt)

サーバへ接続し、結果の中にあるフラグを探す。
普通にncしたらすごい勢いで文字列が出てきたので、
grepしてフラグの部分を引っ掛ける

~/Downloads $ nc 2019shell1.picoctf.com 9525 | grep pico
picoCTF{digital_plumb3r_dd86d037}

whats-the-difference (200pt)

2つの全く同じように見える子猫の写真の差分を取る問題。
stringsをテキストに書き出してdiff取ったら心が折れたので、
調べるとバイナリファイルはcmpコマンドでできるらしい。
-b オプションで差分の内容表示、 -l オプションで全差分を10進数・8進数で表示する。

あとは全部つなげて、 picoCTF{th3yr3_a5_d1ff3r3nt_4s_bu773r_4nd_j311y_aslkjfdsalkfslkflkjdsfdszmz10548}

[saturn@SATURN-MBP.local, ~/Downloads] (土 11 16 - 22:13:27)
~/Downloads $ cmp -lb kitters.jpg cattos.jpg 
  49734 231 M-^Y 160 p
  49735 235 M-^] 151 i
  49736 230 M-^X 143 c
  49737 310 ?    157 o
  87663  12 ^J   103 C
 162650 364 ?    124 T
 175231 153 k    106 F
 175232 261 ?    173 {
 211986 230 M-^X 164 t
 211987 222 M-^R 150 h
 211988  15 ^M    63 3
 211989 330 ?    171 y
 284427 122 R    162 r
 292340 174 |     63 3
 292341 371 ?    137 _
 331830 216 M-^N 141 a
 331831 365 ?     65 5
 426632 346 ?    137 _
 439903 360 ?    144 d
 515770 112 J     61 1
 515771 252 ?    146 f
 583608 341 ?    146 f
 640996 310 ?     63 3
 688795  77 ?    162 r
 688796 107 G     63 3
 702943  23 ^S   156 n
 751424 243 ?    164 t
 754731  61 1    137 _
 754732 113 K     64 4
 754733 274 ?    163 s
 754734 304 ?    137 _
 796226  43 #    142 b
 871159 256 ?    165 u
 871160   6 ^F    67 7
 871161 316 ?     67 7
 871162 346 ?     63 3
 927506 347 ?    162 r
 927507 212 M-^J 137 _
 927508 122 R     64 4
 994666 376 ?    156 n
 994667  43 #    144 d
 994668 377 ?    137 _
1068577 234 M-^\ 152 j
1068578 344 ?     63 3
1068579 203 M-^C  61 1
1068580 222 M-^R  61 1
1068581 162 r    171 y
1101444   5 ^E   137 _
1101445 173 {    141 a
1101446   7 ^G   163 s
1101447 300 ?    154 l
1171017  53 +    153 k
1171018 147 g    152 j
1171019 356 ?    146 f
1241182  51 )    144 d
1241183 224 M-^T 163 s
1241184 200 M-^@ 141 a
1241185 106 F    154 l
1272572 217 M-^O 153 k
1272573 156 n    146 f
1337150   4 ^D   163 s
1410459 345 ?    154 l
1410460 340 ?    153 k
1460208   5 ^E   146 f
1510914 237 M-^_ 154 l
1567157 322 ?    153 k
1567158 100 @    152 j
1567159  42 "    144 d
1567160 220 M-^P 163 s
1567161 205 M-^E 146 f
1581925 315 ?    144 d
1581926 244 ?    163 s
1581927 215 M-^M 172 z
1581928 147 g    155 m
1581929 257 ?    172 z
1677065 176 ~     61 1
1677066 341 ?     60 0
1764510 357 ?     65 5
1764511 210 M-^H  64 4
1764512  31 ^Y    70 8
1766742  13 ^K   175 }

where-is-the-file (200pt)

シェルサーバの指定ディレクトリにフラグを隠したとのこと。
いつも通り ls -ltrするとダメ

saturnglave@pico-2019-shell1:/problems/where-is-the-file_4_f26b413d005c16c61f12
7740ab242b35$ ls -ltr
total 0

どうせ隠しファイルでしょ、ということで ls -la を実行すると、
怪しいファイルが見えた。

saturnglave@pico-2019-shell1:/problems/where-is-the-file_4_f26b413d005c16c61f12
7740ab242b35$ ls -la
total 80
drwxr-xr-x   2 root       root        4096 Sep 28 22:05 .
drwxr-x--x 684 root       root       69632 Oct 10 18:02 ..
-rw-rw-r--   1 hacksports hacksports    39 Sep 28 22:05 .cant_see_me

中身を確認すると、フラグ。

saturnglave@pico-2019-shell1:/problems/where-is-the-file_4_f26b413d005c16c61f12
7740ab242b35$ less .cant_see_me
picoCTF{w3ll_that_d1dnt_w0RK_cb4a5081}

mus1c (300pt)

渡された歌詞を解読しろとのこと。ヒントはrockstar。
調べると、本当にRockStarというプログラミング言語があった!

Pico's a CTFFFFFFF
my mind is waitin
It's waitin

Put my mind of Pico into This
my flag is not found
put This into my flag
put my flag into Pico


shout Pico
shout Pico
shout Pico

My song's something
put Pico into This

Knock This down, down, down
put This into CTF

shout CTF
my lyric is nothing
Put This without my song into my lyric
Knock my lyric down, down, down

shout my lyric

Put my lyric into This
Put my song with This into my lyric
Knock my lyric down

shout my lyric

Build my lyric up, up ,up

shout my lyric
shout Pico
shout It

Pico CTF is fun
security is important
Fun is fun
Put security with fun into Pico CTF
Build Fun up
shout fun times Pico CTF
put fun times Pico CTF into my song

build it up

shout it
shout it

build it up, up
shout it
shout Pico

拡張子を .rockにして保存する。
さっきのサイトにオンラインコンパイラがあったので、 拝借すると、数字が出てきた。

114
114
111
99
107
110
114
110
48
49
49
51
114

これをCyberChefにかけると、Decimalからの変換でヒット。
フラグの囲み文字で囲って、 picoCTF{rrrocknrn0113r}