Trace Kerberos authentication protocol carriers - #21730
Draft
eve0805 wants to merge 3 commits into
Draft
Conversation
|
Thanks for your pull request! As part of our landing process, we manually verify that all modules work as expected. We've added the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Depends on #21717 and #21729.
This PR adds application-protocol carrier tracing for Kerberos service authentication over HTTP, SMB, LDAP, and MSSQL.
It builds on the service-authentication trace events and presentation introduced by #21729. The carrier callbacks describe where GSS-Kerberos or SPNEGO tokens are transported by each application protocol, while reusing the shared token parsing from #21717.
This is a stacked PR. Until its dependencies are merged, the GitHub diff against
masteralso includes the commits from #21717 and #21729.Functionality
This adds 10 request/response carrier callbacks:
AuthorizationheaderWWW-AuthenticateheaderserverSaslCredsHTTP
Authorizationheaders.WWW-Authenticateheaders.KerberosandNegotiateresponse schemes.SMB
LDAP
initial_credential.serverSaslCreds.MSSQL
Carrier presentation
The Kerberos subscriber interface now includes:
on_protocol_carrierServiceAuthenticationTracePresenterpresents carrier metadata including, when available:Carrier tokens are identified as:
NegTokenInitNegTokenRespMalformed or unsupported carrier tokens are shown as structured parse failures.
Trace modes
Protocol carriers are shown in the existing
metadataandfulltrace modes:metadatareports structured carrier and token metadata while redacting binary contents.fullincludes hexadecimal binary token contents.Tracing failures are isolated from the authentication flow and do not interrupt authentication.
Scope
This PR owns the generic protocol-carrier event, its presentation, and the HTTP, SMB, LDAP, and MSSQL integrations.
It does not introduce:
Testing
Direct unit tests cover all four protocol integrations and their request/response callbacks, together with the carrier subscriber and presenter behavior.
The following affected test suites were run:
bundle exec rspec \ spec/lib/rex/proto/kerberos \ spec/lib/msf/core/exploit/remote/kerberos \ spec/lib/msf/base/serializer/readable_text_spec.rb \ spec/lib/rex/proto/http/client_spec.rb \ spec/lib/msf/core/exploit/remote/smb/client/kerberos_authentication_spec.rb \ spec/lib/rex/proto/ldap/auth_adapter/rex_kerberos_spec.rb \ spec/lib/rex/proto/mssql/client_spec.rb