2014年1月26日日曜日

SECCON2013 online writeup - repeat after me ネットワーク・Web 100

SECCON2013 online の writeup です。
ネットワーク・Webの100点問題、repeat after me です。
問題はfollowme.capというキャプチャファイルを渡されてフラッグをゲットせよというもの。

キャプチャファイルなので Wireshark で眺める。内容を追っていると、telnet で接続している事がわかる。そこで適当に TCP stream を見ていると、tcp.stream eq 1 の内容で外部サーバへ ssh 接続して flag.txt を表示しているのがわかる。



このサーバにアクセスして flag.txt の内容を確認すればよいとわかる。そこで、接続先サーバおよびユーザ名とパスワードを同じ TCP steam から抜き出す。


まず、接続先はfollowme@133.0xf2.010357となっている。0x 以降は16進の書き方で、変換方法がわからないので、まずは同じように ssh を試してみる。

ssh -p 31337 followme@133.0xf2.010357
The authenticity of host '[133.0xf2.010357]:31337 ([133.242.16.239]:31337)' can't be established.
RSA key fingerprint is 2d:cb:9b:98:70:f4:67:e7:02:03:15:ab:32:59:78:68.
Are you sure you want to continue connecting (yes/no)? yes

すると、アドレスが 133.242.16.239 、ユーザ名が followme とわかる。これは 0xf2 が16進で10進に変換すると 242、010357 は8進数になっており、16進数に直してから10EFとなり二桁ずつ10進数に変換すると16と239が得られる。

次にパスワード部分だが、wireshark に記載されているものを直接入力してもうまくいかない。Delete やバックスペースなどの制御文字があるため、それらを削除または同じように動作させる必要がある。

今回は ssh ツールを使用して同じような動作をさせてみる。まずは、パスワード部分の切り出し。

network100# hexdump -C pass.bin | more
00000000  6c 73 20 2d 6c 15 66 6f  6c 6c 6f 77 6d 65 24 20  |ls -l.followme$ |
00000010  77 68 6f 61 6d 69 17 6c  73 2d 6c 7f 7f 2e 20 2d  |whoami.ls-l... -|
00000020  6c 2e 02 7f 0d 00 6c 73  20 2d 6c                 |l.....ls -l|
0000002b

このファイルを sshpass で読み込んで接続させる。

network100# sshpass -f pass.bin ssh -p 31337 followme@133.242.16.239
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sun Jan 26 15:13:58 JST 2014

  System load:  0.0               Processes:           83
  Usage of /:   1.1% of 96.47GB   Users logged in:     2
  Memory usage: 15%               IP address for eth0: 133.242.16.239
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/

38 packages can be updated.
21 updates are security updates.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Last login: Sun Jan 26 14:10:16 2014 from kd124212144186.ppp-bb.dion.ne.jp
followme$ ls -l
total 4
-r--r--r-- 1 0 0 25 Dec 24 10:55 flag.txt

あとは flag.txt を確認するだけ。

followme$ more flag.txt 
-sh: 2: more: not found
followme$ cat flag.txt
Interesting_IPv4_address
followme$ 


答えは上記のとおり。





0 件のコメント:

コメントを投稿