-
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
LDAP capture capabilities #18678
LDAP capture capabilities #18678
Conversation
Shifting appropriate methods to Auth lib
* invert storage test for callback * do not override service instance domain and hostname * remove wrapping `Array` on `context_data` in response * generate NTLM Type1 message instead of hardcoded blob
adjustments to NTLM LDAP support
OptString.new('Domain', [ false, 'The default domain to use for NTLM authentication', 'DOMAIN']), | ||
OptString.new('Server', [ false, 'The default server to use for NTLM authentication', 'SERVER']), | ||
OptString.new('DnsName', [ false, 'The default DNS server name to use for NTLM authentication', 'SERVER']), | ||
OptString.new('DnsDomain', [ false, 'The default DNS domain name to use for NTLM authentication', 'example.com']), |
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.
Should these options be required?
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.
No there are defaults provided and these would not be used at all during a simple auth attempt.
# @param ctx [Hash] Framework context for sockets | ||
# @param dblock [Proc] Handler for :dispatch_request flow control interception | ||
# @param sblock [Proc] Handler for :send_response flow control interception | ||
# | ||
# @return [Rex::Proto::LDAP::Server] LDAP Server object | ||
def initialize(lhost = '0.0.0.0', lport = 389, udp = true, tcp = true, ldif = nil, comm = nil, ctx = {}, dblock = nil, sblock = nil) | ||
def initialize(lhost = '0.0.0.0', lport = 389, udp = true, tcp = true, ldif = nil, comm = nil, auth_provider = nil, ctx = {}, dblock = nil, sblock = nil) |
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.
I haven't had a chance to dive through the code fully yet to see if the existing callsites are impacted by this change; is it worth adding this new argument to the end to make sure it's a backwards compatible API change either way
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.
There is currently only one caller "the module mixin", in theory auth will be consistently extended in the rex class however this offers a place to inject a different provider. I don't see a strong reason to avoid it, especially since these are all named parameters.
* clarify the NTLM SASL challenge * add default case for unsuppoted SASL types * implement unknown method to support override
I still haven't had the time to run through this properly yet, I've only done a rough pass a few days ago now - but everything worked well for the scenarios I did test 👍 Here's the notes I did take at the time, feel free to ignore until a fuller test has been completed though 👍
metasploit-framework/plugins/capture.rb Lines 196 to 210 in 5478806
That way it should get wired up to the capture plugin https://github.com/rapid7/metasploit-framework/blob/54788067ffb5391bf987986a8549cb1b4a066453/docs/metasploit-framework.wiki/How-To-Use-Plugins.md#capture-plugin 🤞
ftp example:
This module:
|
I will look into item 1, Will also see about adding to item 2. As to item 3, |
Thanks for the fixes 🎉 I did another pass and everything looks good; just these two bits I spotted
And stacktrace from the logs:
If you don't have a DC setup, I think this should work to replicate things without needing to set up one: Forge a ldap silver ticket:
Run the capture module:
Run the ldap query module with the forged ticket - updating the ticket path:
And the stacktrace was in |
* support mechanism reported as NTLM or GSS-SPNEGO * return ResultCodeAuthMethodNotSupported for unknown bindRequest auth
@adfoster-r7 stacktrace is addressed in e5b5f12, I also pushed another change to address a stacktrace in the server that attempted to access an incorrect variable when the listener fails a read. The service manager |
Awesome; Looks like Kerberos is handled and logged now - thanks! 🎉
|
Release NotesAdds a new |
Thanks @jmartin-tech and @JustAnda7! 🎉 Let me know if I've missed anything in the release notes above, happy to change them if need be. These changes will be picked up and available in next week's Thursday release |
Pull request additionally announced as part of this weekly wrapup post - https://www.rapid7.com/blog/post/2024/02/23/metasploit-weekly-wrap-up-02-23-2024/ - thanks! 👍 |
Integrates support for LDAP capture of simple and NTLM authentication attempts.
389
Many thanks to GSoC Contributor @JustAnda7!
Verification
List the steps needed to make sure this thing works
msfconsole
use capture/ldap
run
nmap -p 389 --script /usr/share/nmap/scripts/ldap-brute.nse --script-args ldap.base='"cn=users,dc=example,dc=com"' 127.0.0.1 -Pn -d
ldapsearch -LLL -H ldap://127.0.0.1 -D [email protected] -W
NTLM
attemptldapsearch -H ldap://127.0.0.1 -Y ntlm -U admin -b 'dc=example,dc=com'