@@ -11,19 +11,31 @@ class LDAP
1111 include Metasploit ::Framework ::LDAP ::Client
1212 include Msf ::Exploit ::Remote ::LDAP
1313
14+ LIKELY_PORTS = [ 389 , 636 ]
15+ LIKELY_SERVICE_NAMES = [ 'ldap' , 'ldaps' , 'ldapssl' ]
16+
1417 attr_accessor :opts , :realm_key
1518 # @!attribute use_client_as_proof
1619 # @return [Boolean] If a login is successful and this attribute is true - an LDAP::Client instance is used as proof
1720 attr_accessor :use_client_as_proof
1821
22+ # This method sets the sane defaults for things
23+ # like timeouts and TCP evasion options
24+ def set_sane_defaults
25+ self . opts ||= { }
26+ self . connection_timeout = 30 if self . connection_timeout . nil?
27+ nil
28+ end
29+
1930 def attempt_login ( credential )
2031 result_opts = {
2132 credential : credential ,
2233 status : Metasploit ::Model ::Login ::Status ::INCORRECT ,
2334 proof : nil ,
2435 host : host ,
2536 port : port ,
26- protocol : 'ldap'
37+ protocol : 'tcp' ,
38+ service_name : 'ldap'
2739 }
2840
2941 result_opts . merge! ( do_login ( credential ) )
@@ -34,7 +46,8 @@ def do_login(credential)
3446 opts = {
3547 username : credential . public ,
3648 password : credential . private ,
37- framework_module : framework_module
49+ framework_module : framework_module ,
50+ ldap_auth : 'auto'
3851 } . merge ( @opts )
3952
4053 connect_opts = ldap_connect_opts ( host , port , connection_timeout , ssl : opts [ :ssl ] , opts : opts )
0 commit comments