Skip to content

Conversation

@Dfte
Copy link
Contributor

@Dfte Dfte commented Sep 28, 2025

This PR reworks the MSSQL protocol to support Channel Binding token implementation based on fortra/impacket#1986.

The PR is simple, first I had to remove the base sock computation since TDS.py handles it itself. Next I add to switch the TLS context in the enum_host_infos function:

image

Basically the set_tls_context, creates a TLS tunnel that allows passing data to encrypt and receiving unencrypted data. The Channel Binding Token is computed inside that function and added to the NTLMSSP messages when necessary. As such we can now connect to CBT protected databases:

image

That said, the Kerberos authentication doesn't seem to work with or without the patch (without below):

Image

I'll fix that before merging.

@Dfte
Copy link
Contributor Author

Dfte commented Sep 28, 2025

Ah shit, just realised it breaks the enum_host when TLS is not required:

image

@NeffIsBack NeffIsBack added the enhancement New feature or request label Sep 28, 2025
@Dfte
Copy link
Contributor Author

Dfte commented Sep 28, 2025

At this point:

  • Enforced ChannelBinding works:
image
  • TLS enforced without ChannelBinding works:
image
  • TLS not enforced works as well:
image

Need to patch the Kerberos error tho

@Dfte
Copy link
Contributor Author

Dfte commented Sep 28, 2025

My bad it was just a DNS error:

image

All good then.

@Dfte Dfte changed the title Add ChannelBinding computing for MSSQL [MSSQL] Add ChannelBinding computing for MSSQL Sep 28, 2025
@Dfte
Copy link
Contributor Author

Dfte commented Sep 28, 2025

The MSSQL protocol now prints whether encryption is used or not:

  • Used:
image
  • Not used:
image

sed Encryption/EncryptionReq

Signed-off-by: Deft_ <[email protected]>
@Dfte
Copy link
Contributor Author

Dfte commented Sep 30, 2025

#713 Will close this one

@NeffIsBack NeffIsBack linked an issue Sep 30, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement channel binding check on mssql protocol

2 participants