@@ -11,19 +11,31 @@ class LDAP
11
11
include Metasploit ::Framework ::LDAP ::Client
12
12
include Msf ::Exploit ::Remote ::LDAP
13
13
14
+ LIKELY_PORTS = [ 389 , 636 ]
15
+ LIKELY_SERVICE_NAMES = [ 'ldap' , 'ldaps' , 'ldapssl' ]
16
+
14
17
attr_accessor :opts , :realm_key
15
18
# @!attribute use_client_as_proof
16
19
# @return [Boolean] If a login is successful and this attribute is true - an LDAP::Client instance is used as proof
17
20
attr_accessor :use_client_as_proof
18
21
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
+
19
30
def attempt_login ( credential )
20
31
result_opts = {
21
32
credential : credential ,
22
33
status : Metasploit ::Model ::Login ::Status ::INCORRECT ,
23
34
proof : nil ,
24
35
host : host ,
25
36
port : port ,
26
- protocol : 'ldap'
37
+ protocol : 'tcp' ,
38
+ service_name : 'ldap'
27
39
}
28
40
29
41
result_opts . merge! ( do_login ( credential ) )
@@ -34,7 +46,8 @@ def do_login(credential)
34
46
opts = {
35
47
username : credential . public ,
36
48
password : credential . private ,
37
- framework_module : framework_module
49
+ framework_module : framework_module ,
50
+ ldap_auth : 'auto'
38
51
} . merge ( @opts )
39
52
40
53
connect_opts = ldap_connect_opts ( host , port , connection_timeout , ssl : opts [ :ssl ] , opts : opts )
0 commit comments