Network Connections That Should Not Exist
Every connection belongs to a process, and most Windows processes have a narrow job, so the print spooler serves printers and print clients. Some reach out by design, such as a service host fetching updates or a spooler printing to a web address, but a process whose job never needs the internet does not hold a connection to an internet address. Such a connection usually means code running inside a genuine process and talking in its name, or a program under a borrowed name reaching whoever runs it. Tie each connection to its process first, then ask whether that process has any reason to reach that address.
Normal and Suspicious
A clean machine sits beside a suspicious one, and the pointer marks where to look.
Normal
A clean Windows 11 install
| Protocol | Remote Address | State |
|---|---|---|
| TCP | to 192.0.2.30:445 | Established |
Suspicious
ws-042,
| Protocol | Remote Address | State |
|---|---|---|
| TCP | to 198.51.100.23:443 | Established |
| Remote AddressAn internet address: the print spooler serves printers and print clients, so this needs a reason. Network Connections That Should Not Exist | ||
Look Inside
Why It Matters
Malware has to reach whoever runs it, and code injected into a genuine process talks in that process's name. A core process or a print spooler holding an internet connection is that traffic showing.
How to Confirm It
Work through these in order. Each step names the page that shows how.
- Tie each connection to its process, with Get-NetTCPConnection or netstat live, or windows.netscan in a memory image, which can also list closed ones while memory still holds them.Network Connections
- Check the owner against its profile. A genuine process with a connection it has no reason for points to code running inside it.Process Listings and Scans
- Read the owner's threads and where each one starts. A thread that starts in memory no file backs is a lead to code running inside it.Threads
- Read its memory regions. A private region created to run and be written, with no file behind it, is a lead, not proof, since just-in-time compilers make them too.Memory Regions
- Pull the DNS queries and the first connection time (Sysmon events 22 and 3, DeviceNetworkEvents) and set them on the timeline.Network Connections
What Defenders See
Each record names its log and what must be switched on to get it.
| Record and Where It Lands | What to Read | How to Turn It On |
|---|---|---|
3 Network connection (opens in a new tab)Microsoft-Windows-Sysmon/OperationalIt is written on any Windows computer running Sysmon. | Image, DestinationIp, DestinationPort and Initiated for each connection. It is off by default, and it carries no command line.Network Connections shows how to read it. | Run Sysmon with NetworkConnect events in its configuration. They are off by default. |
22 DNSEvent (DNS query) (opens in a new tab)Microsoft-Windows-Sysmon/OperationalIt is written on any Windows computer running Sysmon. | QueryName and the process behind each DNS lookup, the name a connection was meant for.Network Connections shows how to read it. | Run Sysmon with DnsQuery events in its configuration. |
| Device | RemoteIP, RemotePort, RemoteUrl and RemoteIPType with the initiating process and its command line. | The Defender for Endpoint sensor on the device |
| Device | The signer of the connecting binary, joined on SHA1. An unsigned or untrusted file talking out is FalconForce's hunt. | The Defender for Endpoint sensor on the device |
- False Positives
A spooler sending jobs to a printer at a web address, through Windows' HTTP print provider, and service hosts that fetch updates reach out by design, so check the address against what the process is for.
- Blind Spots
Sysmon's network event is off by default and carries no command line, so the owner's arguments come from its creation record.
A connection that closed before a live check may no longer show in netstat. windows.netscan may still find it while memory holds it, and Sysmon or DeviceNetworkEvents keep a record.
Hunt It
The same hunt is written for four tools, so pick the one you use. Defender XDR and Sentinel queries are in KQL, which you paste into Advanced hunting in the Defender portal or into Sentinel's Logs page. Splunk queries are in SPL, for its Search page, and Velociraptor queries are in VQL, which you run as a hunt.
Needs Defender for Endpoint. ActionType says what kind of connection each row is. A hit is one to explain, as printers, cloud print services and updates come first, and anything left points to the process itself.
// Core Windows processes, and built-in proxies started with no arguments, in connections with public addressesDeviceNetworkEvents| where Timestamp > ago( 30d)| where RemoteIPType == "Public"| extend Process = tolower( InitiatingProcessFileName)| where Process in ( "spoolsv.exe", "lsass.exe", "winlogon.exe", "services.exe", "wininit.exe", "csrss.exe", "smss.exe") or ( Process in ( "rundll32.exe", "regsvr32.exe", "dllhost.exe") and InitiatingProcessCommandLine matches regex @"( ?i)( rundll32|regsvr32|dllhost)( \ .exe)?\ W*$")| summarize Connections = count( ), FirstSeen = min( Timestamp), LastSeen = max( Timestamp), Ports = make_set( RemotePort, 10) by DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath, ActionType, RemoteIP, RemoteUrl| order by FirstSeen descIn a Memory Image
Volatility 3 reads a memory image, and each of its plugins below shows part of this sign.
windows.netscan(documentation, opens in a new tab)Memory Image A Volatility 3 plugin. It is one check run on a saved copy of a Windows machine's memory. netscan means network scan. Connections and listeners found by scanning memory, closed ones included while memory still holds them, each with its owning process and creation time.windows.netstat(documentation, opens in a new tab)Memory Image A Volatility 3 plugin. It is one check run on a saved copy of a Windows machine's memory. The connections the network stack itself was tracking at capture.windows.(documentation, opens in a new tab)Memory Image A Volatility 3 plugin from its malware group. It checks a memory image for code that hides, or code put into a process. malfind means find malware. If the owner is genuine, private executable memory in it, where injected code can sit. A clean result does not clear it.malware. malfind windows.(documentation, opens in a new tab)Memory Image A Volatility 3 plugin from its malware group. It checks a memory image for code that hides, or code put into a process. Live threads in the owner that start outside every file-backed image.malware. suspicious_ threads
Rules to Compare With
Security vendors publish detection rules anyone can read. These look for the same thing, so compare your own with them.
Show the 7 Public Rules
- Outbound Network Connection To Public IP Via Winlogon (opens in a new tab) SigmaHQ: Flags winlogon.exe connecting to a public address.
- Rundll32 Internet Connection (opens in a new tab) SigmaHQ: Flags rundll32.exe connecting to a public address.
- Network Connection Initiated By Regsvr32.EXE (opens in a new tab) SigmaHQ: Flags regsvr32.exe making a network connection.
- Suspicious Network Connection Binary No CommandLine (opens in a new tab) SigmaHQ: Flags binaries such as rundll32.exe or regsvr32.exe that run with no command line and make a network connection.
- Rundll32 with no Command Line Arguments with Network (opens in a new tab) Splunk: Flags rundll32.exe with no command-line arguments that then makes a network connection.
- Unusual Process Network Connection (opens in a new tab) Elastic: Flags network connections from system programs that rarely make them.
- T1036.001 - Masquerading: Invalid Code Signature - Network Connections (opens in a new tab) FalconForce: Flags connections to public addresses from binaries whose signature does not validate, by joining DeviceNetworkEvents with DeviceFileCertificateInfo.
How to Prevent It
Each control helps prevent it, and its line says what it does here.
- Network protection (opens in a new tab) Blocks outbound HTTP and HTTPS from any process to domains with a poor reputation.
- Windows Firewall rules (opens in a new tab) Outbound rules can limit which programs reach the internet at all, and the print spooler has little reason to. Check it in the Registry: Windows Firewall Rules
- Print Spooler off where unused (opens in a new tab) Where nothing prints, the spooler can be switched off. Microsoft marks it safe to disable on a server that is neither a print server nor a domain controller.
Sources
- Microsoft Sysinternals: Sysmon (event 3, network connection, off by default) (opens in a new tab)
- Microsoft Learn: DeviceNetworkEvents table (opens in a new tab)
- SigmaHQ: Conhost Spawned By Uncommon Parent Process (genuine service host command lines) (opens in a new tab)
- Microsoft Learn: Service host grouping in Windows 10 (one service per host above 3.5 GB) (opens in a new tab)
- Microsoft Learn: questions and answers on the dosvc service, which downloads Windows updates (opens in a new tab)
- Microsoft Learn: Introduction to print providers (Inetpp.dll sends print jobs to a URL) (opens in a new tab)
- Microsoft Learn: Get-NetTCPConnection (opens in a new tab)
- Elastic: Unusual Process Network Connection (prebuilt rule) (opens in a new tab)
- Elastic: SMB Connections via LOLBin or Untrusted Process (legitimate SMB on port 445 comes from the kernel, PID 4) (opens in a new tab)
- Volatility 3: windows.netscan (opens in a new tab)
MITRE ATT&CK is a free public catalogue of the techniques attackers use. Each technique has an ID, such as T1055 for Process Injection, so defenders can name the same behaviour the same way. This red flag can point to these techniques.
- T1071.001 (opens in a new tab) Application Layer Protocol: Web Protocols
- T1105 (opens in a new tab) Ingress Tool Transfer
- T1571 (opens in a new tab) Non-Standard Port