-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Fix ldap auto authentication #18935
Fix ldap auto authentication #18935
Conversation
When the auth method is set to auto and a domain is specific, use NTLM.
if opts[:username].present? && opts[:domain].present? | ||
connect_opts.merge!(ldap_auth_opts_ntlm(opts)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core of the fix right here. When the username and domain are both specified, use NTLM instead of plaintext.
The other code was moved around so the NTLM code didn't have to be duplicated. Since the NTLM code was placed into a method, and the simple code was already duplicated, it seemed like a good time to refactor everything into their own methods.
Changes look great, thanks for fixing this @zeroSteiner! ✅ Set the USERNAME datastore option to a UPN, see the module works
✅ Set the USERNAME datastore option to a normal username and the DOMAIN option to the domain, see the module works
|
0cd2bc5
Release NotesThis PR fixes a common user mistake when authenticating with LDAP modules. Now users can specify either the USERNAME (user) and DOMAIN (domain.local) datastore options or the original format of just the USERNAME in the UPN format ([email protected]). This fix updates the LDAP library. |
This fixes a common user mistake when authenticating with LDAP modules. Most modules, when set to the default authentication mechanism of
auto
use NTLM. LDAP however uses the simple plaintext mechanism in this case. If the user is expecting to authenticate to a domain controller, the username will need to be in the UPN format ([email protected]
), however, through muscle memory they might specific the DOMAIN datastore option. In this case, their authentication attempt will fail.This updates the LDAP library to check if a domain was specified, and if it was, it'll use NTLM as the authentication mechanism instead of LDAP. Now users can set the DOMAIN datastore option, along with the USERNAME and PASSWORD and things should just work.
Verification
msfconsole
use auxiliary/gather/ldap_query
set LDAP::Auth auto
(the default)