Secure SMB Traffic in Windows Server (2024)

  • Article

As a defense in depth measure, you can use segmentation and isolation techniques to secure SMBtraffic and reduce threats between devices on your network.

SMB is used for file sharing, printing, and inter-process communication such as named pipes and RPC.It's also used as a network data fabric for technologies such as Storage Spaces Direct, StorageReplica, Hyper-V Live Migration, and Cluster Shared Volumes. Use the following sections to configureSMB traffic segmentation and endpoint isolation to help prevent outbound and lateral networkcommunications.

Block inbound SMB access

Block TCP port 445 inbound from the internet at your corporate hardware firewalls. Blocking inboundSMB traffic protects devices inside your network by preventing access from the internet.

If you want users to access their files inbound at the edge of your network, you can use SMB overQUIC. This uses UDP port 443 by default and provides a TLS 1.3-encrypted security tunnel like a VPNfor SMB traffic. The solution requires Windows 11 and Windows Server 2022 Datacenter: AzureEdition file servers running on Azure Stack HCI. For more information, see SMB over QUIC.

Block outbound SMB access

Block TCP port 445 outbound to the internet at your corporate firewall. Blocking outboundSMB traffic prevents devices inside your network from sending data using SMB to the internet.

It is unlikely you need to allow any outbound SMB using TCP port 445 to the internet unless yourequire it as part of a public cloud offering. The primary scenarios include Azure Files and Office365.

If you are using Azure Files SMB, use a VPN for outbound VPN traffic. Byusing a VPN, you restrict the outbound traffic to the required service IP ranges. For moreinformation about Azure Cloud and Office 365 IP address ranges, see:

With Windows 11 and Windows Server 2022 Datacenter: Azure Edition, you can use SMB over QUIC toconnect to file servers in Azure. This uses UDP port 443 by default and provides a TLS 1.3-encryptedsecurity tunnel like a VPN for the SMB traffic. For more information, seeSMB over QUIC.

By inventorying your network's SMB traffic, you get an understanding of traffic that is occurringand can determine if it's necessary. Use the following checklist of questions to help identifyunnecessary SMB traffic.

For server endpoints:

  1. Which server endpoints require inbound SMB access to do their role? Do they need inboundaccess from all clients, certain networks, or certain nodes?
  2. Of the remaining server endpoints, is inbound SMB access necessary?

For client endpoints:

  1. Which client endpoints (for example, Windows 10) require inbound SMB access? Do they need inboundaccess from all clients, certain networks, or certain nodes?
  2. Of the remaining client endpoints, is inbound SMB access necessary?
  3. Of the remaining client endpoints, do they need to run the SMB server service?

For all endpoints, determine if you allow outbound SMB in the safest and most minimal fashion.

Review server built-in roles and features that require SMB inbound. For example, file servers anddomain controllers require SMB inbound to do their role. For more information on built-in rolesand feature network port requirements, seeService overview and network port requirements for Windows.

Review servers that need to be accessed from inside the network. For example, domain controllers andfile servers likely need to be accessed anywhere in the network. However, application server accessmay be limited to a set of other application servers on the same subnet. You can use the followingtools and features to help you inventory SMB access:

  • Use the Get-FileShareInfo command from the AZSBTools module set to examine shares on servers and clients.
  • Enable an audit trail of SMB inbound access using the registry key Security Settings\Advanced Audit Policy Configuration\Audit Policies\Object Access\File Share. Since the number of events may be large, consider enabling for a specified amount of time or use Azure Monitor.

Examining SMB logs lets you know which nodes are communicating with endpoints over SMB. You candecide if an endpoint's shares are in use and understand which to exist.

Configure Windows Defender Firewall

Use firewall rules to add extra connection security. Configure rules to block both inbound andoutbound communications that include exceptions. An outbound firewall policy that prevents use ofSMB connections both outside and inside your managed network while allowing access to the minimumset of servers and no other devices is a lateral defense-in-depth measure.

For information on the SMB firewall rules you need to set for inbound and outbound connections, seethe support articlePreventing SMB traffic from lateral connections and entering or leaving the network.

The support article includes templates for:

  • Inbound rules that are based on any kind of network profile.
  • Outbound rules for private/domain (trusted) networks.
  • Outbound rules for guest/public (untrusted) networks. This template is important to enforce onmobile devices and home-based telecommuters that are not behind your firewall that is blockingoutbound traffic. Enforcing these rules on laptops reduces the odds of phishing attacks that sendusers to malicious servers to harvest credentials or run attack code.
  • Outbound rules that contain an override allowlist for domain controllers and file serverscalled Allow the connection if secure.

To use the null encapsulation IPSEC authentication, you must create a Security Connection rule onall computers in your network that are participating in the rules. Otherwise, the firewallexceptions won't work and you'll only be arbitrarily blocking.

Caution

You should test the Security Connection rule before broad deployment. An incorrect rulecould prevent users from accessing their data.

To create a Connection Security rule, use Windows Defender Firewall with Advanced Security controlpanel or snap-in:

  1. In Windows Defender Firewall, select Connection Security Rules and choose a New rule.
  2. In Rule Type, select Isolation then select Next.
  3. In Requirements, select Request authentication for inbound and outbound connections then select Next.
  4. In Authentication Method, select Computer and User (Kerberos V5) then select Next.
  5. In Profile, check all profiles (Domain, Private, Public) then select Next.
  6. Enter a name your rule then select Finish.

Remember, the Connection Security rule must be created on all clients and servers participating inyour inbound and outbound rules or they will be blocked from connecting SMB outbound. These rulesmay already be in place from other security efforts in your environment and like the firewallinbound/outbound rules, can be deployed via group policy.

When configuring rules based on the templates in thePreventing SMB traffic from lateral connections and entering or leaving the networksupport article, set the following to customize the Allow the connection if secure action:

  1. In the Action step, select Allow the connection if it is secure then select Customize.
  2. In Customize Allow if Secure Settings, select Allow the connection to use null encapsulation.

The Allow the connection if it is secure option allows override of a global block rule. You can usethe easy but least secure Allow the connection to use null encapsulation with *override blockrules, which relies on Kerberos and domain membership for authentication. Windows Defender Firewallallows for more secure options like IPSEC.

For more information about configuring the firewall, see Windows Defender Firewall with Advanced Security deployment overview.

Updated firewall rules (preview)

Important

Windows Server Insiders Edition is currently in PREVIEW.This information relates to a prerelease product that may be substantially modified before it's released. Microsoft makes no warranties, expressed or implied, with respect to the information provided here.

Beginning with Windows 11 Insider preview Build 25992 (Canary) and Windows Server Preview Build 25997, the built-in firewall rules doesn't contain the SMB NetBIOS ports anymore. In earlier versions of Windows Server, when you created a share, the firewall automatically enabled certain rules in the File and Printer Sharing group. In particular, the built-in firewall automatically used inbound NetBIOS ports 137 through 139. Shares made with SMB2 or later don't use NetBIOS ports 137-139. If you need to use an SMB1 server for legacy compatibility reasons, you must manually reconfigure the firewall to open those ports

We made this change to improve network security. This change brings SMB firewall rules more in line with the standard behavior for the Windows Server File Server role. By default, the firewall rule only open the minimum number of ports required for sharing data. Administrators can reconfigure the rules to restore the legacy ports.

Disable SMB Server if unused

Windows clients and some of your Windows Servers on your network may not require the SMB Serverservice to be running. If the SMB Server service isn't required, you can disable the service. Beforedisabling SMB Server service, be sure no applications and processes on the computer require theservice.

You can use Group Policy Preferences to disable the service on a large number of machines when youare ready to implement. For more information about configuring Group Policy Preferences, seeConfigure a Service Item.

Test and deploy using policy

Begin by testing using small-scale, hand-made deployments on select servers and clients. Use phasedgroup policy rollouts to make these changes. For example, start with the heaviest user of SMB suchas your own IT team. If your team's laptops and apps and file share access work well after deployingyour inbound and outbound firewall rules, create test group policy within your broad test and QAenvironments. Based on results, start sampling some departmental machines, then expand out.

Next steps

Watch Jessica Payne's Ignite conference session Demystifying the Windows Firewall

Secure SMB Traffic in Windows Server (2024)

FAQs

How to secure SMB Windows Server? ›

Use the following sections to configure SMB traffic segmentation and endpoint isolation to help prevent outbound and lateral network communications.
  1. Block inbound SMB access. ...
  2. Block outbound SMB access. ...
  3. Inventory SMB usage and shares. ...
  4. Configure Windows Defender Firewall. ...
  5. Disable SMB Server if unused.
Mar 6, 2024

Is Windows SMB traffic encrypted? ›

By default, when you create an SMB server on the storage virtual machine (SVM), SMB encryption is disabled. You must enable it to take advantage of the enhanced security provided by SMB encryption. To create an encrypted SMB session, the SMB client must support SMB encryption.

Is SMB server secure? ›

While the SMB protocol is generally considered safe, it's important to be mindful of potential vulnerabilities and do what you can to prevent them. Here's how to protect yourself when using SMB: Use strong authentication.

Is TLS used for SMB? ›

Transport Layer Security (TLS) Although technically not part of SMB, TLS can be used to further secure the SMB protocol. TLS is a form of Public Key Infrastructure (PKI).

How do I lock down my SMB? ›

Create a new DWORD value named “SMB1” (without quotes). Set the value of SMB1 to 0 to disable SMBv1 or 1 to enable SMBv1. Create a new Multi-String value named “RestrictedIPs” (without quotes). Add the IP address or addresses that you want to restrict SMBv1 communication to, one per line.

Why is SMB not secure? ›

SMB relay attacks exploit SMB's NTLM authentication, potentially allowing attackers to impersonate users and gain unauthorized access. This attack is facilitated by specific prerequisites such as SMB signing disabled on the target, local network access, and user credentials with remote login permissions.

Which versions of SMB are secure? ›

Prefer SMB3 or later whenever possible. Of the 3 major SMB versions, SMB3 — particularly SMB 3.1. 1 — offers the most security. For example, SMB3's secure dialect negotiation limits susceptibility to man-in-the-middle (MITM) attacks and SMB 3.1.

Does Windows Firewall block SMB? ›

Inbound connections to a computer

For Windows clients and servers that do not host SMB shares, you can block all inbound SMB traffic by using the Windows Defender Firewall to prevent remote connections from malicious or compromised devices. In the Windows Defender Firewall, this includes the following inbound rules.

What is Windows SMB vulnerability? ›

It resides within the SMBv3 protocol and can affect newer systems, such as Windows 10 and Windows Server 1903 and 1909. An attacker exploiting this vulnerability can send a specially designed SMBv3 packet to a vulnerable server. Victims who connect to the server are then exposed to remote code execution.

What is the safest SMB? ›

SMB is safest when users: Don't use SMB 1.0, as it lacks encryption protocols. Use SMB 3.0 or later to keep files and users secure.

Is SMB more secure than SFTP? ›

Originally designed for LAN use, SMB facilitates seamless file sharing between Windows computers but lacks the robust encryption found in SFTP. For more information on SMB file sharing click here.

Does Windows Server support SMB? ›

Microsoft Windows operating systems (OSes) since Windows 95 have included client and server SMB protocol support. The Linux OS and macOS also provide built-in support for SMB. In addition, Unix-based systems can use Samba to facilitate SMB access to file and print services.

How to secure SMB traffic? ›

Securing SMB protocols is most important for network security.
  1. Update SMB: Use the latest SMB version for security features.
  2. Encrypt SMB: Enable SMB encryption for data protection.
  3. Strong Authentication: Use robust authentication methods.
  4. Firewall Rules: Restrict SMB access via firewalls to trusted IPs.
Sep 29, 2023

Is SMB port 445 secure? ›

Is Port 445 Safe to Open? Port 445 is unsafe to open for traffic outside your network. If remote users need SMB access, you should provide this through a VPN. At the very least, you should implement SMB 3.0 or higher.

How to check SMB status in Windows? ›

Check SMB status: Check the status of the SMB service by running the command "Get-Service -Name "LanmanServer"" in PowerShell. This command will display the status of the LanmanServer service, which is responsible for the SMB protocol.

How do I mount SMB on Windows Server? ›

Mount the Azure file share
  1. Sign in to the Azure portal.
  2. Navigate to the storage account that contains the file share you'd like to mount.
  3. Select File shares.
  4. Select the file share you'd like to mount.
  5. Select Connect.
  6. Select the drive letter to mount the share to.
  7. Copy the provided script.
May 13, 2024

How do I make my Windows server more secure? ›

So, here's a checklist to make sure your server's security is not compromised in any way.
  1. Use local firewall rules. ...
  2. Think twice before sharing any data: ...
  3. Enforce a strong password policy. ...
  4. Create individual administrative accounts: ...
  5. SQL server instances: ...
  6. Windows updates: ...
  7. Always have a backup plan: ...
  8. Code it right:

What is the secure port for SMB? ›

SMB uses either IP port 139 or 445.
  • Port 139: SMB originally ran on top of NetBIOS using port 139. NetBIOS is an older transport layer that allows Windows computers to talk to each other on the same network.
  • Port 445: Later versions of SMB (after Windows 2000) began to use port 445 on top of a TCP stack.

References

Top Articles
Latest Posts
Article information

Author: Merrill Bechtelar CPA

Last Updated:

Views: 6224

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Merrill Bechtelar CPA

Birthday: 1996-05-19

Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

Phone: +5983010455207

Job: Legacy Representative

Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.