セキュリティ系の勉強・その他開発メモとか雑談. Twitter, ブログカテゴリ一覧
本ブログはあくまでセキュリティに関する情報共有の一環として作成したものであり,公開されているシステム等に許可なく実行するなど、違法な行為を助長するものではありません.

「復習」UTCTF2021

//

初めに

個人的な復習なので、Writeupが読みたい方はこちらに行った方が欲しい情報が得られると思います、、

Hack Bob's Box

FTPとデータのコネクションを貼るためにパブリックなIPが必要そうでした。FTPのところだけメモしておきます。

FTP PORTモード(アクティブモード) TCP/IP入門

# FTPに接続
$ nc 3.236.87.2 8121
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 15:39. Server port: 21.
220-Only anonymous FTP is allowed here
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
USER anonymous #入力
230 Anonymous user logged in
PORT  35,72,157,68,10,10 #入力(awsで割り当てられたクライアントのパブリックIPとポートを指定)
200 PORT command successful
LIST #入力
150 Connecting to port 2570
226-Options: -a -l
226 6 matches total

PORT xx,xx,xx,xx,xx,xxはアクティブモードでのサーバ→クライアントのデータコネクションの確立をするコマンド。なので、当然指定した場所で待ち受けなければならない。

$ nc -lnvp 2570
Listening on 0.0.0.0 2570
Connection received on 3.236.87.2 20
drwxr-xr-x    1 0          0                4096 Mar 12 18:53 .
drwxr-xr-x    1 0          0                4096 Mar 12 18:53 ..
drwxr-xr-x    3 0          0                4096 Mar 12 18:53 .mozilla
drwxr-xr-x    2 0          0                4096 Mar 12 18:53 .ssh
drwxr-xr-x    2 0          0                4096 Mar 12 18:53 docs
drwxr-xr-x    2 0          0                4096 Mar 12 18:53 favs

上にも書いた通り、ホストからこちらに接続するため、パブリックIP(IPv6でも行けるかも?)が必要でした。 ALG (アプリケーション レイヤ ゲートウェイ)をルータで設定すれば行けるかも?
インターネットでFTPに接続するサービスを提供するページで何とかすることもできたらしい。

FTP and SSH online - upload, edit, copy, move, rename & more

f:id:thinline196:20210316210754p:plain f:id:thinline196:20210316210811p:plain