Skip to content

Commit a95425d

Browse files
committed
Check dec instead
1 parent 1d0a3aa commit a95425d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/post/windows/gather/enum_ie.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,14 @@ def run
319319
if val_arr.include?(hash)
320320
data = registry_getvaldata(regpath, hash)
321321
dec = decrypt_reg(url, data)
322-
#decode data and add to creds array
323-
header = dec.unpack("VVVVVV")
324322

325323
# If CryptUnprotectData fails, decrypt_reg() will return "", and unpack() will end up
326324
# returning an array of nils. If this happens, we can cause an "undefined method
327325
# `+' for NilClass." when we try to calculate the offset, and this causes the module to die.
328-
next if header == [nil, nil, nil, nil, nil, nil]
326+
next if dec.empty?
327+
328+
#decode data and add to creds array
329+
header = dec.unpack("VVVVVV")
329330

330331
offset = header[0] + header[1] #offset to start of data
331332
cnt = header[5]/2 # of username/password combinations

0 commit comments

Comments
 (0)