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.
| Target artifact | Windows 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 behaviour | SMB 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 state | SMB 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 Windows | Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol, RequireSecuritySignature, EncryptData |
| Check on Windows | Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol, in PowerShell as Administrator |
| Check from another device | Test-NetConnection -ComputerName PUBLIC_IP -Port 445 in PowerShell, from a network outside yours |
| Fix on Windows | Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol in PowerShell as Administrator, then restart |
| Fix at the router | block TCP 445, UDP 137, UDP 138 and TCP 139 in both directions, and delete any port forward to them |
Read the result
| Setting | Safe value | What it means |
|---|---|---|
EnableSMB1Protocol | False | The SMB server does not accept SMB 1 |
State of the SMB1Protocol feature | Anything but Enabled | Enabled means SMB 1 is installed |
RequireSecuritySignature | True | The server refuses connections that are not signed |
EncryptData | False is normal | True 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:
Get-SmbClientConfiguration | Select-Object RequireSecuritySignature, EnableInsecureGuestLogonsRequireSecuritySignature should read True and EnableInsecureGuestLogons False. Then look at the port itself:
Get-NetTCPConnection -State Listen -LocalPort 445 -ErrorAction SilentlyContinue | Select-Object LocalAddress, LocalPort, OwningProcessA 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.
Set-SmbServerConfiguration -AuditSmb1Access $true
Get-SmbServerConfiguration | Select-Object AuditSmb1AccessMicrosoft 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:
Set-SmbServerConfiguration -EnableSMB1Protocol $falseTo remove the feature itself, save your work first; the computer restarts to finish:
Disable-WindowsOptionalFeature -Online -FeatureName SMB1ProtocolRun both checks again afterwards.
Signing, guest access and encryption
Require signing and refuse guest logons
Set-SmbServerConfiguration -RequireSecuritySignature $true
Set-SmbClientConfiguration -RequireSecuritySignature $true
Set-SmbClientConfiguration -EnableInsecureGuestLogons $falseThese 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:
Set-SmbShare -Name SHARE_NAME -EncryptData $true
Set-SmbServerConfiguration -EncryptData $trueBy 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 : Truemeans 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:
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 BlockAn 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
0xc000a000or "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.
Related guides and lookups
Sources
- Microsoft Learn: detect, enable and disable SMBv1, SMBv2 and SMBv3
- Microsoft Learn: control SMB signing behaviour
- Microsoft Learn: SMB security hardening
- Microsoft Learn: insecure guest logons in SMB2 and SMB3
- Microsoft Learn: SMB security enhancements (encryption)
- Microsoft Learn: secure SMB traffic in Windows Server
- Microsoft Support: preventing SMB traffic from lateral connections and entering or leaving the network
- Microsoft Learn: service overview and network port requirements
- Microsoft Learn: Get-SmbServerConfiguration
- Microsoft Learn: Set-SmbServerConfiguration
- Microsoft Learn: Set-SmbClientConfiguration
- Microsoft Learn: Get-NetTCPConnection
- Microsoft Learn: Test-NetConnection
- Microsoft Learn: Windows Firewall rules and precedence
- Microsoft Learn: New-NetFirewallRule
- Microsoft Learn: Disable-NetFirewallRule