Skip to content

Commit

Permalink
Land #19352, add necessary metadata for bruteforce
Browse files Browse the repository at this point in the history
add necessary metadata for bruteforce
  • Loading branch information
cgranleese-r7 authored Sep 6, 2024
2 parents fa8c80f + e377e74 commit 8e94a0d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/metasploit/framework/login_scanner/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,31 @@ class LDAP
include Metasploit::Framework::LDAP::Client
include Msf::Exploit::Remote::LDAP

LIKELY_PORTS = [ 389, 636 ]
LIKELY_SERVICE_NAMES = [ 'ldap', 'ldaps', 'ldapssl' ]

attr_accessor :opts, :realm_key
# @!attribute use_client_as_proof
# @return [Boolean] If a login is successful and this attribute is true - an LDAP::Client instance is used as proof
attr_accessor :use_client_as_proof

# This method sets the sane defaults for things
# like timeouts and TCP evasion options
def set_sane_defaults
self.opts ||= {}
self.connection_timeout = 30 if self.connection_timeout.nil?
nil
end

def attempt_login(credential)
result_opts = {
credential: credential,
status: Metasploit::Model::Login::Status::INCORRECT,
proof: nil,
host: host,
port: port,
protocol: 'ldap'
protocol: 'tcp',
service_name: 'ldap'
}

result_opts.merge!(do_login(credential))
Expand All @@ -34,7 +46,8 @@ def do_login(credential)
opts = {
username: credential.public,
password: credential.private,
framework_module: framework_module
framework_module: framework_module,
ldap_auth: 'auto'
}.merge(@opts)

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

0 comments on commit 8e94a0d

Please sign in to comment.