Skip to content

Commit 59c4136

Browse files
committed
Land rapid7#4781, handle resolve_sid failure enumerating user profiles
2 parents be5a0ee + bed40a8 commit 59c4136

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/msf/core/post/windows/user_profiles.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ def parse_profiles(hives)
4949
#
5050
def parse_profile(hive)
5151
profile={}
52-
sidinf = resolve_sid(hive['SID'].to_s)
53-
profile['UserName'] = sidinf[:name]
54-
profile['Domain'] = sidinf[:domain]
5552
profile['SID'] = hive['SID']
5653
profile['ProfileDir'] = hive['PROF']
5754
profile['AppData'] = registry_getvaldata("#{hive['HKU']}\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", 'AppData')
@@ -65,6 +62,12 @@ def parse_profile(hive)
6562
profile['Temp'] = registry_getvaldata("#{hive['HKU']}\\Environment", 'TEMP').to_s.sub('%USERPROFILE%',profile['ProfileDir'])
6663
profile['Path'] = registry_getvaldata("#{hive['HKU']}\\Environment", 'PATH')
6764

65+
sidinf = resolve_sid(hive['SID'].to_s)
66+
if sidinf
67+
profile['UserName'] = sidinf[:name]
68+
profile['Domain'] = sidinf[:domain]
69+
end
70+
6871
return profile
6972
end
7073

0 commit comments

Comments
 (0)