SaferComputing.com

Reference · Windows

SMB on port 445: check SMBv1, signing and internet exposure on Windows

Check whether SMBv1 is enabled with Get-SmbServerConfiguration and Get-WindowsOptionalFeature SMB1Protocol, confirm SMB signing and guest access, and keep port 445 blocked from the internet on Windows 11.

Published
Updated
Last checked
Applies to
Windows 11, Windows Server 2019 and later, home and office routers
Technical specification
Target artifactWindows file sharing (SMB) on TCP port 445, answered by the Server service (LanmanServer); the SMB 1 protocol, an optional Windows feature named SMB1Protocol; and the signing, encryption and guest settings of the SMB server and client.
Default behaviourSMB 1 is not installed by default in any edition of Windows 11, or in Windows Server 2019 and later. Starting with version 24H2, Windows 11 Pro, Enterprise and Education require signing on SMB connections in both directions, and Pro no longer connects to other computers' shares as a guest, as Enterprise and Education already did not; Home requires no signing, and Windows Server 2025 requires it on outbound connections only. Encryption is off unless someone turns it on.
Safe stateSMB 1 off and not installed; signing required on the server and the client; insecure guest logons off; TCP 445, UDP 137, UDP 138 and TCP 139 blocked at the router or edge firewall in both directions; inbound 445 also blocked in Windows Defender Firewall on computers that share nothing.
Check on WindowsGet-SmbServerConfiguration | Select-Object EnableSMB1Protocol, RequireSecuritySignature, EncryptData
Check on WindowsGet-WindowsOptionalFeature -Online -FeatureName SMB1Protocol, in PowerShell as Administrator
Check from another deviceTest-NetConnection -ComputerName PUBLIC_IP -Port 445 in PowerShell, from a network outside yours
Fix on WindowsDisable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol in PowerShell as Administrator, then restart
Fix at the routerblock TCP 445, UDP 137, UDP 138 and TCP 139 in both directions, and delete any port forward to them

Read the result

SettingSafe valueWhat it means
EnableSMB1ProtocolFalseThe SMB server does not accept SMB 1
State of the SMB1Protocol featureAnything but EnabledEnabled means SMB 1 is installed
RequireSecuritySignatureTrueThe server refuses connections that are not signed
EncryptDataFalse is normalTrue encrypts every session on this server; single shares can be encrypted instead

The client settings decide how this computer connects to shares on other computers and devices:

Windows PowerShell, as Administrator
Get-SmbClientConfiguration | Select-Object RequireSecuritySignature, EnableInsecureGuestLogons

RequireSecuritySignature should read True and EnableInsecureGuestLogons False. Then look at the port itself:

Windows PowerShell
Get-NetTCPConnection -State Listen -LocalPort 445 -ErrorAction SilentlyContinue | Select-Object LocalAddress, LocalPort, OwningProcess

A listener on port 445 is normal while the Server service runs. What matters is who can reach it: the firewall rules and the router, below.

Why port 445 must not face the internet

Microsoft's guidance is that SMB traffic coming from the internet, or going to it, is unlikely to be legitimate. Perimeter firewalls should block unsolicited inbound traffic and outgoing traffic on TCP 445 and on the NetBIOS ports UDP 137, UDP 138 and TCP 139. Blocking inbound SMB protects the computers inside the network; blocking outbound SMB stops them sending data to the internet over SMB.

Microsoft says you are unlikely to need outbound SMB to the internet unless a public cloud service requires it, such as Azure Files, which it says to reach through a VPN. For access to files from outside, it points to SMB over QUIC, which uses UDP port 443 by default inside a TLS 1.3 tunnel.

Turn off SMB 1

Find what still uses SMB 1

Turn on auditing, leave it running for a while, then read the Microsoft-Windows-SMBServer\Audit event log. Each time a client tries to connect with SMB 1, the log gets an event with ID 3000.

Windows PowerShell, as Administrator
Set-SmbServerConfiguration -AuditSmb1Access $true
Get-SmbServerConfiguration | Select-Object AuditSmb1Access

Microsoft recommends updating the SMB server that still needs SMB 1 rather than reinstalling SMB 1.

Turn SMB 1 off, or remove it

To turn it off in the server configuration straight away, with no restart:

Windows PowerShell, as Administrator
Set-SmbServerConfiguration -EnableSMB1Protocol $false

To remove the feature itself, save your work first; the computer restarts to finish:

Windows PowerShell, as Administrator
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol

Run both checks again afterwards.

Signing, guest access and encryption

Require signing and refuse guest logons
Windows PowerShell, as Administrator
Set-SmbServerConfiguration -RequireSecuritySignature $true
Set-SmbClientConfiguration -RequireSecuritySignature $true
Set-SmbClientConfiguration -EnableInsecureGuestLogons $false

These are already the defaults on Windows 11 Pro, Enterprise and Education from version 24H2. Guest logons support neither signing nor encryption, and requiring signing also stops guest access to shares. Microsoft recommends against turning insecure guest logons back on.

Encrypt shares that hold sensitive files

Encryption needs SMB 3.0 or later on both ends. Encrypt one share, or every share on the server:

Windows PowerShell, as Administrator
Set-SmbShare -Name SHARE_NAME -EncryptData $true
Set-SmbServerConfiguration -EncryptData $true

By default, clients that cannot encrypt are refused: they get Access denied, and the server logs event 1003 in Microsoft-Windows-SmbServer/Operational. Microsoft advises updating those clients rather than allowing unencrypted access.

Block port 445

At the router or edge firewall
  • Block TCP 445, UDP 137, UDP 138 and TCP 139 inbound from the internet and outbound to it.
  • On a home router, delete any port forward to port 445, and turn off UPnP unless something needs it. Home router check shows where to look. If a NAS shares files on your network, check its own exposure too: Synology and QNAP NAS on the internet.
  • Test from a network outside yours, such as a phone's hotspot. TcpTestSucceeded : True means the internet can reach port 445: block it now. If it still connects, see Open-port self-audit.
In Windows Defender Firewall, on computers that share nothing

Microsoft suggests blocking all inbound SMB on computers that do not host shares, with one rule for all profiles:

Windows PowerShell, as Administrator
Get-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-In)' | Select-Object DisplayName, Enabled, Profile
Disable-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-In)'
New-NetFirewallRule -DisplayName 'Block all inbound SMB 445' -Direction Inbound -Protocol TCP -LocalPort 445 -Action Block

An explicit block rule takes precedence over any conflicting allow rule. Folders and printers shared from this computer stop working for others; this computer can still open shares elsewhere. Never put this rule on file servers or domain controllers. On Windows installed in another language, the rule's display name is translated.

Troubleshooting

A NAS, printer or older device stopped working
  • 0xc000a000 or "The cryptographic signature is invalid": the device does not allow SMB signing.
  • 0x80070035 "The network path was not found", or "System error 3227320323 has occurred": the device may rely on guest access.

Microsoft does not recommend turning signing off or guest logons back on as a workaround. Update the device, give its share a user name and password if it supports them, or replace it.

NetBIOS ports 137 to 139

Starting with Windows 11 version 24H2 and Windows Server 2025, the built-in firewall rules no longer include the NetBIOS ports 137 to 139. Only SMB 1 needed them; shares made with SMB 2 or later do not use them.

Sources