@@ -31,10 +31,11 @@ def initialize
31
31
and connected to a database this module will record successful
32
32
logins and hosts so you can track your access.
33
33
} ,
34
- 'Author' => [
35
- 'tebo <tebo [at] attackresearch [dot] com>' , # Original
36
- 'Ben Campbell <eat_meatballs [at] hotmail.co.uk>' # Refactoring
37
- ] ,
34
+ 'Author' =>
35
+ [
36
+ 'tebo <tebo [at] attackresearch [dot] com>' , # Original
37
+ 'Ben Campbell <eat_meatballs [at] hotmail.co.uk>' # Refactoring
38
+ ] ,
38
39
'References' =>
39
40
[
40
41
[ 'CVE' , '1999-0506' ] , # Weak password
@@ -45,15 +46,18 @@ def initialize
45
46
deregister_options ( 'RHOST' , 'USERNAME' , 'PASSWORD' )
46
47
47
48
@accepts_guest_logins = { }
48
- @correct_credentials_status_codes = [ "STATUS_INVALID_LOGON_HOURS" ,
49
- "STATUS_INVALID_WORKSTATION" ,
50
- "STATUS_ACCOUNT_RESTRICTION" ,
51
- "STATUS_ACCOUNT_EXPIRED" ,
52
- "STATUS_ACCOUNT_DISABLED" ,
53
- "STATUS_ACCOUNT_RESTRICTION" ,
54
- "STATUS_PASSWORD_EXPIRED" ,
55
- "STATUS_PASSWORD_MUST_CHANGE" ,
56
- "STATUS_LOGON_TYPE_NOT_GRANTED" ]
49
+
50
+ @correct_credentials_status_codes = [
51
+ "STATUS_INVALID_LOGON_HOURS" ,
52
+ "STATUS_INVALID_WORKSTATION" ,
53
+ "STATUS_ACCOUNT_RESTRICTION" ,
54
+ "STATUS_ACCOUNT_EXPIRED" ,
55
+ "STATUS_ACCOUNT_DISABLED" ,
56
+ "STATUS_ACCOUNT_RESTRICTION" ,
57
+ "STATUS_PASSWORD_EXPIRED" ,
58
+ "STATUS_PASSWORD_MUST_CHANGE" ,
59
+ "STATUS_LOGON_TYPE_NOT_GRANTED"
60
+ ]
57
61
58
62
# These are normally advanced options, but for this module they have a
59
63
# more active role, so make them regular options.
@@ -63,7 +67,7 @@ def initialize
63
67
OptString . new ( 'SMBUser' , [ false , "SMB Username" ] ) ,
64
68
OptString . new ( 'SMBDomain' , [ false , "SMB Domain" , '' ] ) ,
65
69
OptBool . new ( 'PRESERVE_DOMAINS' , [ false , "Respect a username that contains a domain name." , true ] ) ,
66
- OptBool . new ( 'RECORD_GUEST' , [ false , "Record guest-privileged random logins to the database" , false ] ) ,
70
+ OptBool . new ( 'RECORD_GUEST' , [ false , "Record guest-privileged random logins to the database" , false ] )
67
71
] , self . class )
68
72
69
73
end
@@ -98,19 +102,22 @@ def check_login_status(domain, user, pass)
98
102
connect ( )
99
103
status_code = ""
100
104
begin
101
- simple . login ( datastore [ 'SMBName' ] ,
102
- user ,
103
- pass ,
104
- domain ,
105
- datastore [ 'SMB::VerifySignature' ] ,
106
- datastore [ 'NTLM::UseNTLMv2' ] ,
107
- datastore [ 'NTLM::UseNTLM2_session' ] ,
108
- datastore [ 'NTLM::SendLM' ] ,
109
- datastore [ 'NTLM::UseLMKey' ] ,
110
- datastore [ 'NTLM::SendNTLM' ] ,
111
- datastore [ 'SMB::Native_OS' ] ,
112
- datastore [ 'SMB::Native_LM' ] ,
113
- { :use_spn => datastore [ 'NTLM::SendSPN' ] , :name => self . rhost } )
105
+ simple . login (
106
+ datastore [ 'SMBName' ] ,
107
+ user ,
108
+ pass ,
109
+ domain ,
110
+ datastore [ 'SMB::VerifySignature' ] ,
111
+ datastore [ 'NTLM::UseNTLMv2' ] ,
112
+ datastore [ 'NTLM::UseNTLM2_session' ] ,
113
+ datastore [ 'NTLM::SendLM' ] ,
114
+ datastore [ 'NTLM::UseLMKey' ] ,
115
+ datastore [ 'NTLM::SendNTLM' ] ,
116
+ datastore [ 'SMB::Native_OS' ] ,
117
+ datastore [ 'SMB::Native_LM' ] ,
118
+ { :use_spn => datastore [ 'NTLM::SendSPN' ] , :name => self . rhost }
119
+ )
120
+
114
121
# Windows SMB will return an error code during Session Setup, but nix Samba requires a Tree Connect:
115
122
simple . connect ( "\\ \\ #{ datastore [ 'RHOST' ] } \\ IPC$" )
116
123
status_code = 'STATUS_SUCCESS'
@@ -212,13 +219,18 @@ def try_user_pass(domain, user, pass)
212
219
print_status ( output_message % "GUEST LOGIN" )
213
220
report_creds ( domain , user , pass , true )
214
221
elsif datastore [ 'VERBOSE' ]
215
- print_status ( output_message % "GUEST LOGIN" )
222
+ print_status ( output_message % "GUEST LOGIN" )
216
223
end
217
224
end
225
+
226
+ return :next_user
227
+
218
228
when *@correct_credentials_status_codes
219
229
print_status ( output_message % "FAILED LOGIN, VALID CREDENTIALS" )
220
230
report_creds ( domain , user , pass , false )
221
231
validuser_case_sensitive? ( domain , user , pass )
232
+ return :skip_user
233
+
222
234
when 'STATUS_LOGON_FAILURE' , 'STATUS_ACCESS_DENIED'
223
235
vprint_error ( output_message % "FAILED LOGIN" )
224
236
else
0 commit comments