@@ -93,22 +93,9 @@ def validate_connect_options!
9393 end
9494
9595 def run_host ( ip )
96- ignore_public = ignore_private = false
97- case datastore [ 'LDAP::Auth' ]
98- when Msf ::Exploit ::Remote ::AuthOption ::SCHANNEL
99- ignore_public = ignore_private = true
100- when Msf ::Exploit ::Remote ::AuthOption ::KERBEROS
101- ignore_private = !datastore [ 'ANONYMOUS_LOGIN' ] && !datastore [ 'LDAPPassword' ]
102- end
103-
104- cred_collection = build_credential_collection (
105- username : datastore [ 'LDAPUsername' ] ,
106- password : datastore [ 'LDAPPassword' ] ,
107- realm : datastore [ 'LDAPDomain' ] ,
108- anonymous_login : datastore [ 'ANONYMOUS_LOGIN' ] ,
109- blank_passwords : false ,
110- ignore_public : ignore_public ,
111- ignore_private : ignore_private
96+ cred_collection = build_specific_credential_collection (
97+ void_login : datastore [ 'LDAP::Auth' ] == Msf ::Exploit ::Remote ::AuthOption ::SCHANNEL ,
98+ no_password_login : datastore [ 'LDAP::Auth' ] == Msf ::Exploit ::Remote ::AuthOption ::KERBEROS && !datastore [ 'ANONYMOUS_LOGIN' ] && !datastore [ 'LDAPPassword' ]
11299 )
113100
114101 pkcs12_storage = Msf ::Exploit ::Remote ::Pkcs12 ::Storage . new ( framework : framework , framework_module : self )
@@ -215,4 +202,25 @@ def session_setup(result)
215202
216203 start_session ( self , nil , merge_me , false , my_session . rstream , my_session )
217204 end
205+
206+ def build_specific_credential_collection ( void_login :, no_password_login :)
207+ if void_login
208+ Metasploit ::Framework ::PrivateCredentialCollection . new ( {
209+ nil_passwords : true
210+ } )
211+ elsif no_password_login
212+ Metasploit ::Framework ::CredentialCollection . new ( {
213+ username : datastore [ 'LDAPUsername' ] ,
214+ nil_passwords : true
215+ } )
216+ else
217+ build_credential_collection (
218+ username : datastore [ 'LDAPUsername' ] ,
219+ password : datastore [ 'LDAPPassword' ] ,
220+ realm : datastore [ 'DOMAIN' ] ,
221+ anonymous_login : datastore [ 'ANONYMOUS_LOGIN' ] ,
222+ blank_passwords : false
223+ )
224+ end
225+ end
218226end
0 commit comments