FileDropper
Msf::Exploit::FileDropper は、exploit / post が対象に置いたファイルやディレクトリを後で消すための追跡機構です。実装は lib/msf/core/exploit/file_dropper.rb です。
include
Section titled “include”include Msf::Exploit::FileDropper主要 API
Section titled “主要 API”| メソッド | 用途 |
|---|---|
register_file_for_cleanup(path) | ファイル削除予約 |
register_files_for_cleanup(*paths) | 複数ファイル |
register_dir_for_cleanup(path) | ディレクトリ削除予約 |
register_dirs_for_cleanup(*paths) | 複数ディレクトリ |
cleanup | 終了時の削除試行(mixin がフック) |
def exploit remote = '/tmp/' + Rex::Text.rand_text_alpha(8) write_file_via_vuln(remote, payload.encoded) register_file_for_cleanup(remote)
execute_remote(remote)endvars_form_data = [ { 'name' => 'upload', 'data' => payload.encoded, 'filename' => 'shell.php', 'content_type' => 'application/octet-stream' }]send_request_cgi( 'method' => 'POST', 'uri' => normalize_uri(target_uri.path, 'upload.php'), 'vars_form_data' => vars_form_data)register_file_for_cleanup('shell.php')セッション取得後にも削除を試みます。消せない場合もあるので、writeup / notes 側に「何を置いたか」を残します。

