Fix SMB signing detection reporting "required" when only enabled#14
Open
ndog7 wants to merge 1 commit into
Open
Fix SMB signing detection reporting "required" when only enabled#14ndog7 wants to merge 1 commit into
ndog7 wants to merge 1 commit into
Conversation
… signing is merely enabled (not required). Since a server that only enables signing is a valid NTLM relay target, this caused relayable hosts to be misclassified as protected.
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.
The SMB detector read signing state from impacket's RequireSigning flag (and isSigningRequired(), which returns the same value). impacket force-sets RequireSigning=True for any SMB 3.1.1 session regardless of the server's actual security mode because 3.1.1 uses pre-auth integrity ("Always Sign"). Since Windows 10 / Server 2016+ negotiate 3.1.1 by default, hosts with signing merely enabled (a valid relay target) were misclassified as "signing required" and dropped as protected.
Fix: derive signing from the authoritative signal the SMB2_NEGOTIATE_SIGNING_REQUIRED bit in the server's negotiate-response SecurityMode via a new _get_signing_required() helper:
SMB1 -> isSigningRequired() (accurate on the SMB1 path)
SMB >= 3.0 -> test ServerSecurityMode & SMB2_NEGOTIATE_SIGNING_REQUIRED directly, bypassing impacket's 3.1.1 override
SMB 2.0/2.1 -> RequireSigning (accurate; override doesn't apply and ServerSecurityMode isn't populated below 3.0)
Changes (protocols/smb_detector.py):
Add _get_signing_required(conn) helper encapsulating the logic above
Route all four signing read sites through the helper:
Remove the now-unused per-site
smbv1 = (dialect == SMB_DIALECT)locals