🎃
ファジングツール"boofuzz"を試す。
環境
Ubuntu 22.04
引用
以下のサイト記載内容を試しています。
boofuzzの導入
Python仮想環境を作ります。
python3 -m venv venv
source venv/bin/activate
boofuzzをダウンロードします。
pip3 install boofuzz
FTPサーバー
以下のリポジトリからFTPサーバーのコードを持ってきます。
git clone https://github.com/Siim/ftp
cd ftp
make
生成されたバイナリを実行します。
./ftp
ftp/seerver.cを見ると、8021番ポートで接続できるようです。
$ grep -n "8021" server.c
208: server(8021);
接続します。
$ ftp localhost 8021
Connected to localhost.
220 A very warm welcome!
Name (localhost:user):
接続できました。
boofuzzサンプルコード実行
上記サイトから、ftp_sample.pyをコピーします。
サンプルのコードは21番ポートになっているので8021に変更します。
ftp_sample.py
def main():
"""
This example is a very simple FTP fuzzer. It uses no process monitory
(procmon) and assumes that the FTP server is already running.
"""
session = Session(target=Target(connection=TCPSocketConnection("127.0.0.1", 8021)))
### session = Session(target=Target(connection=TCPSocketConnection("127.0.0.1", 21)))
define_proto(session=session)
session.fuzz()
変更を保存したら、実行します。
python3 ftp_simple.py
ファジングの実行状況は以下URLで確認できます。
http://127.0.0.1:26000
ファジング結果調査
ファジングの結果はSQLデータベースとして保存されます。sqlite3を使って中身を確認できます。
$ sqlite3 boofuzz-results/run-2026-02-18T08-58-43.db
なんのログがあるか見てみます。
sqlite> SELECT type, COUNT(*) AS cnt
FROM steps
GROUP BY type
ORDER BY cnt DESC;
type cnt
------- ------
info 149690
step 93091
send 38110
receive 19815
pass 18295
error 1
receiveがあることがわかります。
sqlite> SELECT typeof(data) AS t, COUNT(*) AS cnt
FROM steps
WHERE type='receive'
GROUP BY typeof(data);
t cnt
---- -----
blob 19815
blobのようなので、hexで以降検索します。
sqlite> SELECT DISTINCT test_case_index AS case_no
FROM steps
WHERE type='receive'
AND substr(hex(data),1,6)='323330'
ORDER BY case_no;
case_no
-------
9817
11655
11882
12027
12086
12935
13178
14656
230で応答したケースが8件あるようです。
12086のケースについて、詳細を見てみます。
sqlite> SELECT type, substr(hex(data),1,200) AS data_hex, timestamp
FROM steps
WHERE test_case_index = 12086
AND type='send'
ORDER BY timestamp;
type data_hex timestamp
---- ------------------------------------------------------------ -------------------------
send 5553455220616E6F6E796D6F75730D0A [2026-02-18 18:34:46,443]
send 50415353206A616D65730D0A [2026-02-18 18:34:46,444]
send 313131313131313131313131313131313131313131313131313131313131 [2026-02-18 18:34:46,444]
313131313131313131313131313131313131313131313131313131313131
313131313131313131313131313131313131313131313131313131313131
31313131313131313131
それぞれのsendの内容を確認します。
send 55534552 20 616E6F6E796D6F7573 0D0A
→ USER anonymous\r\n
send 50415353 20 6A616D6573 0D0A
→ PASS james\r\n
send 31 31 31 31 ... は ASCII で全部 '1'
このときの応答を見てみます。
sqlite> SELECT type, substr(hex(data),1,200) AS data_hex, timestamp
FROM steps
WHERE test_case_index = 12086
AND type='receive'
ORDER BY timestamp;
type data_hex timestamp
------- ------------------------------------------------------------ -------------------------
receive 32323020412076657279207761726D2077656C636F6D65210A3333312055 [2026-02-18 18:34:46,443]
736572206E616D65206F6B61792C206E6565642070617373776F72640A
receive 323330204C6F67696E207375636365737366756C0A [2026-02-18 18:34:46,444]
receiveのそれぞれをASCIIに直すと
220 A very warm welcome!
331 User name okay, need password
230 Login successful
となっており、ログインが成功していることがわかります。
まとめ
boofuzzを使ってファジングを実行できることがわかりました。ファジングの入力と結果はSQLに保存されるので、あとから特定の応答に至った入力を特定することができることがわかりました。
Discussion