Skip to content
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

Fix SMB signing detection when SMB1 is disabled #16326

Merged
merged 1 commit into from
Mar 11, 2022

Conversation

zeroSteiner
Copy link
Contributor

@zeroSteiner zeroSteiner commented Mar 10, 2022

The smb_version module will detect whether or not the remote server requires SMB signatures. This information is relevant for certain classes of attacks. There exists a bug in the detection logic right now that causes servers that require signatures to be misclassified as not requiring signatures when the SMB 1 protocol version is not enabled. This is due to how the detection occurs. When SMB 1 is not enabled, the SMB 1 negotiation fails, leaving the #peer_require_signing flag in it's default state of false. These changes add the signing_required key to the info hash generated by #smb_proto_info and ensure that it's only set from a successful negotiation.

Verification

List the steps needed to make sure this thing works

  • Configure a Windows 10 client system to demonstrate the vulnerability
  • Start msfconsole
  • Use the auxiliary/scanner/smb/smb_version module
  • Set the RHOSTS value to the Windows 10 system and scan it
  • See that SMB signing is required and that SMB versions 2 and 3 are enabled but SMB 1 is not
    • Previously when SMB 1 was disabled on the target, the SMB signing field would be incorrectly set to "optional"

Example

msf6 auxiliary(scanner/smb/smb_version) > show options 

Module options (auxiliary/scanner/smb/smb_version):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOSTS   192.168.159.86   yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   THREADS  1                yes       The number of concurrent threads (max one per host)

msf6 auxiliary(scanner/smb/smb_version) > run

[*] 192.168.159.86:445    - SMB Detected (versions:2, 3) (preferred dialect:SMB 3.1.1) (compression capabilities:LZNT1) (encryption capabilities:AES-128-CCM) (signatures:required) (guid:{cdd4f1fe-d709-4bfa-8dc9-55666231f5f1}) (authentication domain:DESKTOP-RTCRBEV)
[*] 192.168.159.86:       - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/smb/smb_version) > 

@adfoster-r7
Copy link
Contributor

Working as expected for me 👍

Master:

msf6 auxiliary(scanner/smb/smb_version) > run smb://192.168.123.25

[*] 192.168.123.25:445    - SMB Detected (versions:2, 3) (preferred dialect:SMB 3.1.1) (compression capabilities:) (encryption capabilities:AES-128-CCM) -->(signatures:optional)<-- 

This branch:

msf6 auxiliary(scanner/smb/smb_version) > run smb://192.168.123.25
 
[*] 192.168.123.25:445    - SMB Detected (versions:2, 3) (preferred dialect:SMB 3.1.1) (compression capabilities:) (encryption capabilities:AES-128-CCM) -->(signatures:required)<--

@adfoster-r7 adfoster-r7 merged commit d928504 into rapid7:master Mar 11, 2022
@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Mar 11, 2022

Release Notes

Fixes SMB signing detection for the scanner/smb/smb_version module when the target server has SMB1 disabled

@adfoster-r7 adfoster-r7 added the rn-fix release notes fix label Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug module rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants