Skip to content

Commit 29bfc1c

Browse files
committed
add necessary metadata for bruteforce
1 parent 951a330 commit 29bfc1c

File tree

1 file changed

+16
-2
lines changed
  • lib/metasploit/framework/login_scanner

1 file changed

+16
-2
lines changed

lib/metasploit/framework/login_scanner/ldap.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,32 @@ class LDAP
1111
include Metasploit::Framework::LDAP::Client
1212
include Msf::Exploit::Remote::LDAP
1313

14+
# TODO: Verify if we need this additional metadata: https://github.com/rapid7/metasploit-framework/blob/master/lib/metasploit/framework/login_scanner/http.rb#L15-L23
15+
LIKELY_PORTS = [ 389, 636 ]
16+
LIKELY_SERVICE_NAMES = [ 'ldap', 'ldaps', 'ldapssl' ]
17+
1418
attr_accessor :opts, :realm_key
1519
# @!attribute use_client_as_proof
1620
# @return [Boolean] If a login is successful and this attribute is true - an LDAP::Client instance is used as proof
1721
attr_accessor :use_client_as_proof
1822

23+
# This method sets the sane defaults for things
24+
# like timeouts and TCP evasion options
25+
def set_sane_defaults
26+
self.opts ||= {}
27+
self.connection_timeout = 30 if self.connection_timeout.nil?
28+
nil
29+
end
30+
1931
def attempt_login(credential)
2032
result_opts = {
2133
credential: credential,
2234
status: Metasploit::Model::Login::Status::INCORRECT,
2335
proof: nil,
2436
host: host,
2537
port: port,
26-
protocol: 'ldap'
38+
protocol: 'tcp',
39+
service_name: 'ldap'
2740
}
2841

2942
result_opts.merge!(do_login(credential))
@@ -34,7 +47,8 @@ def do_login(credential)
3447
opts = {
3548
username: credential.public,
3649
password: credential.private,
37-
framework_module: framework_module
50+
framework_module: framework_module,
51+
ldap_auth: 'auto'
3852
}.merge(@opts)
3953

4054
connect_opts = ldap_connect_opts(host, port, connection_timeout, ssl: opts[:ssl], opts: opts)

0 commit comments

Comments
 (0)