-
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
NTLM support for the LDAP capture capabilities #18376
NTLM support for the LDAP capture capabilities #18376
Conversation
Some notes from GSoC sync conversations: Desired adjustments:
Idea for future processing, allow capture module to be configured for specific response patterns for bind (not required)
|
a562033
to
795e622
Compare
795e622
to
6972a91
Compare
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.
As discussed previously, the implementation here for #on_dispatch_request()
can be pushed down into the LDAP server as default functionality and the authentication processing can then become shared capability provided by the LDAP server class.
Authentication processing looks to be directly related to a BindRequest
PDU and a parser and processor for these request can return an object that the service would use to determine the "credential" data to be stored.
Consider this means that each method in the server class need to be scoped to be independent of Framework output helpers like print_status
or those helpers need to be injected into the server object.
Shifting appropriate methods to Auth lib
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.
Thanks for the updated revisions, I added some comments about possible utilization of Net::NTLM::Message::*
classes for parsing the messages instead of implementing parser methods in Auth
. (This is optional but I think will reduce the code required significantly.)
This PR will need rspec
for Rex::Proto::LDAP::Server
and Rex::Proto::LDAP::Auth
at a minimum.
@@ -74,6 +75,7 @@ def initialize(lhost = '0.0.0.0', lport = 389, udp = true, tcp = true, ldif = ni | |||
self.listener_thread = nil | |||
self.dispatch_request_proc = dblock | |||
self.send_response_proc = sblock | |||
@auth_provider = auth_provider |
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.
Check the type on auth_provider
, might be even better to raise an ArgumentError
when value is not nil and not of type Rex::Proto::LDAP::Auth
.
Any further changes 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.
Testing shows this is working well for simple auth with the revision to capture/ldap.rb
regarding :post_pdu
, however NTLM auth does not succeed.
With all the changes I am suggesting to evaluate mechanism
during SASL
auth attempts ldapsearch
expectations still result in a decode error:
$ ldapsearch -H ldap://server.example.com -Y ntlm -U admin -b 'dc=server,dc=example,dc=com'
SASL/NTLM authentication started
ldap_sasl_interactive_bind: Decoding error (-4)
additional info: SASL(-5): bad protocol / cancel: server didn't issue valid NTLM challenge
Digging into the type2 message generated in Ruby seems to be valid so I suspect something is not quite right in the serialization for the Net::LDAP::PDU::BindResult
being returned to ldapsearch
.
* 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
@JustAnda7 I have posted a PR that resolves the issues I had in testing. I will hold off a couple days for you to test if you would like to. After that if not already merged, I will merge directly here so I can land this release the new functionality for upstream. |
adjustments to NTLM LDAP support
I have merged the PR. You can go ahead and land the branch on upstream. So far I think it works well and good. |
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']), | ||
OptBool.new('ForceDefault', [ false, 'Force the default settings', false]), |
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.
Just a note, this option is not used
by the implementation.
Looking at where it came from, I suspect this is from intention to mimic http_nltm
behavior. For now I will just remove this options during land of this PR.
a4e8714
into
rapid7:GSoC/LDAP-Capture-Capabilities
Release NotesThis PR adds support for LDAP capture of NTLM authentication and adds a default implementation for LDAP |
This PR is a follow up to #18125
This PR aims to increase the scope of capturing authentication details from LDAP clients by supporting NTLM Authentication.
Verification
List the steps needed to make sure this thing works
msfconsole
use auxiliary/server/capture/ldap
SRVHOST
,SRVPORT
if required.CHALLENGE
to another value if necessaryNote Points