Port 445 is the door Windows uses for file sharing. It carries SMB, the protocol behind shared folders, mapped drives and network printing, and in most CA offices it is how every desk reaches the Tally data folder on the server. Inside the office that is normal and necessary. Reachable from the internet, port 445 is a serious SMB security risk, and one of the most attacked ports there is.
This post explains why, how to check whether your server is exposed, and how to close port 445 to the internet without breaking file sharing in the office.
What SMB and port 445 do
Server Message Block (SMB) lets Windows computers share files and printers. Opening a shared folder, mapping a drive letter or printing to a shared printer all use it, over TCP port 445. The problem starts when the same port can also be reached from outside, so anyone on the internet can try to connect to your server’s file sharing.
Why an exposed port 445 is dangerous
Port 445 was the route for WannaCry in May 2017. It used the EternalBlue exploit against a flaw in SMB version 1 that Microsoft had patched in March 2017 in MS17-010, and it spread to unpatched machines worldwide. Even without a headline exploit, an exposed port 445 lets an attacker:
- Guess passwords. SMB accepts Windows usernames and passwords, so it is a second front for brute-force attacks next to Remote Desktop.
- Map your shares. With any working account, they can list shared folders and see where the client data lives.
- Use the next SMB flaw. New SMB vulnerabilities still appear. An unpatched server with 445 open to the internet is exposed to each one from the day it is published.
- Spread further. Inside a network, attackers and ransomware use SMB to move from one machine to the next. That is a reason to keep SMB inside the office, not to switch it off there.
Is your server exposed?
Two layers decide it. If the server sits behind an office router, the internet can only reach port 445 if the router forwards it (or the server is set as the router’s “DMZ host”). If the server has its own public IP, as cloud servers usually do, Windows Firewall and the cloud security group are the only barriers. Check both.
- The router. Open its port-forwarding (sometimes “virtual server” or “NAT”) page and look for 445, or a DMZ entry pointing at the server. There is almost never a legitimate reason for either.
- Windows Firewall. In an elevated PowerShell window, this lists the enabled inbound rules for port 445 and who they allow:
Get-NetFirewallPortFilter | Where-Object LocalPort -eq 445 | Get-NetFirewallRule | Where-Object { $_.Enabled -eq 'True' -and $_.Direction -eq 'Inbound' } | Select-Object DisplayName, Profile, Action, @{n='RemoteAddress';e={($_ | Get-NetFirewallAddressFilter).RemoteAddress}}
A RemoteAddress of Any on an Allow rule means the firewall accepts SMB from anywhere. LocalSubnet means only the office network. Finally, test from outside the office (a laptop on a phone hotspot), using your public IP: Test-NetConnection 203.0.113.10 -Port 445 should report TcpTestSucceeded : False.
How to fix it without breaking office file sharing
A word on the one-line fix you will find in many guides: adding a Windows Firewall rule that blocks inbound port 445. In Windows Firewall, a block rule beats every allow rule (Microsoft). A blanket block on 445 therefore also blocks the office PCs, and mapped drives and the shared Tally folder stop working. Simply disabling the allow rules has the same effect. The aim is narrower: allow SMB from the office, refuse it from everywhere else.
1. Close it at the router
Delete any port forward for 445 and any DMZ host entry. On a cloud server, remove 445 from the security group’s inbound rules. This is the block that matters most.
2. Scope the Windows Firewall rules to the office network
Rather than adding a block rule, limit the existing File and Printer Sharing rules to your local subnet. In an elevated PowerShell window:
Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound | Set-NetFirewallRule -RemoteAddress LocalSubnet
Or in an elevated Command Prompt:
netsh advfirewall firewall set rule group="File and Printer Sharing" dir=in new remoteip=localsubnet
If staff reach the share from another office subnet or over a VPN, add those address ranges after LocalSubnet, separated by commas, or they will lose access. Run the listing command from the previous section again afterwards: any other Allow rule on 445 that still says Any (often one a software vendor added) needs the same treatment.
3. Get rid of SMBv1
Version 1 of the protocol is the one EternalBlue attacked. It is not installed by default on Windows Server 2019 and later, but Windows Server 2016 still has it (Microsoft).
To check SMBv1 on the server side, in an elevated PowerShell window:
Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force switches off the server side of SMBv1. To remove it completely, use Uninstall-WindowsFeature -Name FS-SMB1 on Windows Server, or Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol on Windows 10 and 11, then restart. Very old devices that only speak SMBv1, such as Windows XP machines and some old scanners or NAS boxes, will lose access to the share; replace them rather than keep SMBv1.
4. Keep Windows patched
SMB fixes arrive in the monthly updates, and staying current matters because port 445 stays open inside the office.
How Prixl Warden handles port 445
Warden’s security audit reads the server’s Windows Firewall rules. Its “SMB (445)” and “SMB Internet Exposure” checks flag an enabled inbound rule that allows port 445 from any address, and “SMBv1 Disabled” checks the old protocol. Because Warden reads the server’s own firewall, it cannot see your router: behind an office router, the port-forward decides whether the internet can really reach 445, so check the router as well.
On a paid plan, the Hardening tab offers two different fixes for an exposed 445, and the difference matters:
- “SMB Internet Exposure” (a safe fix). Restricts SMB to your local network: Warden adds a firewall rule that allows port 445 from the LAN and a block rule for internet addresses. Office file sharing keeps working. A “Restrict mode” option chooses “LAN only (no Guard access)” or “LAN + Guard”, which also lets staff connected through Prixl Guard Secure Access reach the share from home. The same restriction is available as the “LAN only” and “LAN + Guard” buttons on the Open Ports tab (see restricting risky ports). This is the one to use.
- “Port 445 Open” (a risky fix). Disables every inbound allow rule for port 445. Warden labels it risky and warns before applying: “WARNING: File sharing, printer access, and domain communication may break.” Only choose it on a server that shares nothing with the office.
Every applied fix can be reverted from the “Previously Applied” list. Warden also has a safe “SMBv1” fix that switches off the server side of SMBv1, with the same warning about very old devices. Alongside the audit, Warden watches the server’s sign-in events, so password-guessing through SMB or Remote Desktop shows up in your alerts.
To see what your own server has open, start your 30-day free trial of Prixl Warden. The trial runs the full audit; the one-click fixes need a paid plan.
