Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add necessary metadata for bruteforce #19352

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading