Fix missing attributes on LDAP SSL sockets #19751
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Metasploit's LDAP sockets use the SSL wrapping logic provided by the Net::LDAP module. This means the socket gets swapped to an OpenSSL socket when SSL is enabled and the socket doesn't have some attributes that Metasploit expects. When that socket is treated as one used for a session, this missing information gets propagated up and is shown to the user. This is the issue described in #19744.
This change fixes it by extending the SSL socket after it's setup with the
Forwardable
module and defines delegators for the#localinfo
and#peerinfo
to come from the underlying socket (@io
). This allows the local and peer socket address to be passed up and displayed to the user. Previously, the missing attribute would cause an exception to be raised which would result in an address of 127.0.0.1 being shown to the user for a session.Verification
ldap/ldap_login
moduleCreateSession
andSSL
totrue
, enable the SSL session feature if necessaryDemo (Old and Broken)
Demo (New and Fixed)