shinobi CTF

HTBとCTF頑張る

Trend Micro CTF 2017 SCADA 300 writeup

Challenge

Within the ICS enviroment there has been some odd behavior with one of the network switches. You have asked your Network Administrators to see if they could pull some traffic from their packet capture solution. They dug into the issue and couldn’t make sense of whats going on but think that there may be an attacker that has figured out a backdoor into the system based off an SSH connection.
Figure out how the attacker was able to exploit the system, and utilize the backdoor to SSH into the system.
To submit the flag, you’ll have to wrap the backdoor into TMCTF{}
Download the file (https://s3-ap-northeast-1.amazonaws.com/trendmicro-ctf-2017/2VjxmQSdV3uBQvReFLea/files19.enc) Decrypt the downloaded file by the following command.
> openssl enc -d -aes-256-cbc -k lnlzeirDTOWxKBdpBTsz -in files19.enc -out files19.zip
> unzip files19.zip

 

files19.zipを解凍するとinteresting_artifacts.pcapという名前のpcapファイルが1つ与えられます。パケットをざっと眺めると、前半にHTTP、後半にSSHのやり取りがされていることが分かる。後半部分のSSHは問題文にあるbackdoorに関連するのだろうということで、HTTPに注目して進めます。
すると、exproit.tar.gzというかなり怪しいファイルをPOSTしているリクエストが見つかるので、wiresharkのExport Objects機能でSaveします。不正なファイルアップロードってとこか。残念ながら、tar.gzフォーマットでは出力してくれませんので、exploit.tar.gzの部分だけ取り出します。hexdumbで出力してくれたファイルを見ます。 f:id:grapeBiscuit:20170626141019p:plain

gzipファイルのマジックナンバー1F 8Bなので、0x98byte目からがexploit.tar.gzの始まりだと分かります。binwalkを使っても分かります。binwalkとtarコマンドで展開していく。f:id:grapeBiscuit:20170626141858p:plain

展開すると、etc,usr,varディレクトリが出てきます。etcの下にはpasswdファイルも含まれており、そのリストの中にはパスワードハッシュ付きでTMCTFユーザがリストされています。このハッシュをJohn the Ripperで当てにいく。パスワードリストにはヒント通りrockyou.txtを使う。 f:id:grapeBiscuit:20170626170924p:plain

パスワードが割れたので、早速フラグを送って見ます。TMCTF{odagirih}
…違うようです。調べると、Unixのパスワードは8文字までのようです。もしかしたら辞書ファイルにはもっと長い文字列が書き込まれていたのかも。 f:id:grapeBiscuit:20170626171238p:plain

やはりそうでした。

Flag

TMCTF{odagirihayato}

しかし、オダギリハヤトって誰なんだろう、、、