Detection of Unauthorized SMB Traffic to the Internet
This brief documents the risks and detection strategies for internal Windows SMB (TCP 139/445) traffic traversing the network perimeter, a common indicator of unauthorized remote access or data exfiltration.
SMB (Server Message Block) is a protocol designed for local resource sharing, such as files and printers, within trusted network segments. Exposing SMB directly to the Internet significantly increases the attack surface, as threat actors frequently target this protocol to establish backdoors, gain initial access, or exfiltrate sensitive data.
Defenders should treat any observed outbound SMB traffic originating from internal IP ranges to external, non-private destinations as a high-fidelity indicator of potential compromise. Such activity often suggests that an internal host has been infected with malware, is participating in a C2 channel, or is being used to stage data for exfiltration. Organizations should ensure that firewalls explicitly block TCP ports 139 and 445 at the network egress point to prevent accidental or malicious exposure.
Impact
Successful exploitation or misuse of SMB over the internet can lead to unauthorized remote code execution, unauthorized access to sensitive file shares, and large-scale data exfiltration. If an internal system initiates SMB traffic to an external attacker-controlled server, it may result in the full compromise of that system and provide the attacker with a persistent foothold for lateral movement within the network.
Recommendation
- Implement strict egress filtering on all perimeter firewalls to block TCP 139 and 445 to the public internet.
- Deploy the provided detection logic to identify internal systems attempting to communicate over SMB to external IP addresses.
- Investigate any alerts generated by this logic by reviewing the source system for malware or indicators of unauthorized access.
- Review network configurations to identify and remediate any misconfigured devices that might be routing SMB traffic to the internet.
- Exclude verified legitimate services, such as cloud-based backup solutions or site-to-site VPNs, from the detection alerts by adding their IP ranges to your environment's allowlist.
Immediate actions
Block TCP 139/445 at the network perimeter.
Threat Hunt
Historical network flow analysis for outbound SMB traffic.
Data: Netflow / Firewall logs
Detection coverage 1
Detect Outbound SMB Activity to the Internet
mediumDetects internal hosts attempting to communicate using the SMB protocol (TCP 139 or 445) to external, non-private IP addresses.
Detection queries are available on the platform. Get full rules →