Internal Scanning: When One Host Starts Knocking on Every Door
Picture a hotel corridor at two in the morning. One guest walks the length of it, trying the handle on every single door, one after another, in order. Most doors are locked, a few open, and the guest moves on regardless. Nobody in any single room would notice anything unusual — one rattle of one handle — but the night manager watching the hallway camera sees the pattern instantly. On a network, that guest is a scanning host, and the hallway camera is your flow data and your firewall's deny log.
Internal scanning is what a compromised or misbehaving machine does when it wants to find out what else is nearby. It checks which addresses answer and which services are listening. It looks for where the file shares and databases and management interfaces live. It is loud in a very particular way: lots of tiny, mostly failed connections in a short window. That shape is easy to describe and easy to detect. It is also easy to confuse with several perfectly legitimate tools you already run.
This guide shows you what sweeps and scans look like from the defender's side. It covers which legitimate scanners to identify and allowlist before you turn on any alert. It explains how to write alerting logic that holds up. It also shows what to do when a host that should not be scanning starts knocking on every door.
In this guide
- What a scan looks like from the defender's side
- Sweep, scan, or just a chatty app: a signature table
- The legitimate scanners to allowlist first
- Alerting logic that holds up
- Reading a firewall deny log for fan-out
- The response: identify, verify, isolate, preserve
- Where to go next
What a scan looks like from the defender's side
There are two basic shapes, and you will see both.
A host sweep (also called a ping sweep or network sweep) is one source touching many destinations. It usually uses the same port or the same probe to find out which addresses are alive. In a flow table it is a single source address fanning out to dozens or hundreds of destination addresses in a minute or two. Often the addresses are in numerical order: .1, .2, .3, and so on up the subnet. Most of those destinations do not exist or do not answer, so most of the flows are tiny and one-directional.
A port scan is one source touching many ports on one destination (or a few destinations) to find out which services are listening. In the flow table it is a single source-destination pair with an unusual number of distinct destination ports in a short time. The ports may march upward in sequence, or hit a well-known list of interesting services, or both. Again, most attempts fail: a closed port produces a single small packet in each direction and nothing more.
Both shapes share four fingerprints that make them stand out against ordinary traffic:
- One source, unusual fan-out. Normal hosts talk to a handful of servers. A scanning host talks to far more distinct addresses or ports than it ever has before, and than any of its peers do.
- Lots of tiny, failed connections. A completed conversation carries data both ways. A scan is mostly attempts: a single packet out, a rejection or silence back. Flow records show minimal bytes and packet counts, and firewalls show a burst of denies.
- Sequential targets. Addresses or ports increasing in order is a strong tell. Humans and applications do not visit hosts alphabetically.
- A short time window. A sweep of a whole subnet can complete in well under a minute. The compression in time is as much a signature as the fan-out itself.
Two places show you this most clearly. Flow data from your switches, routers, or firewalls records every attempted connection whether it succeeded or not. So a sweep appears as a spray of one-packet flows from one address. And the deny log on any firewall, including the host firewalls on servers, records each rejected attempt. It includes a timestamp, source, destination, and port. So a scan that crosses a firewall boundary writes its own confession, one line per knock.
Sweep, scan, or just a chatty app: a signature table
The hardest part of scan detection is not spotting fan-out. It is telling a scan from the many applications that legitimately talk to lots of things. The table below is the mental model. The right-hand column is what saves you from paging yourself about the print spooler.
| Signature | Host sweep | Port scan | Normal chatty application |
|---|---|---|---|
| Distinct destinations per minute | Very high (tens to hundreds) | Low (one or a few) | Moderate and stable day to day |
| Distinct ports per destination | One or a few, the same on every target | Very high on one target | A small, fixed set the application is documented to use |
| Bytes per flow | Tiny, mostly one packet | Tiny, mostly one packet | Varies; real data moves |
| Success rate | Mostly failures (no reply or reject) | Mostly failures | Mostly successes |
| Ordering | Addresses often sequential | Ports often sequential | Whatever order the work requires |
| Duration | Seconds to minutes, then stops | Seconds to minutes, then stops | Continuous or on a known schedule |
| Firewall denies | Burst from one source to many destinations | Burst from one source to one destination, many ports | Few; the app knows where its servers are |
| Repeats? | Sometimes daily if scheduled by a tool; otherwise once | Same | Constantly, and identically across all hosts of that type |
Notice the row labeled "success rate." That single distinction does most of the work. A backup agent contacting forty servers has forty conversations. A sweep contacting forty addresses has forty attempts and perhaps five conversations. Fan-out plus failure is a scan; fan-out plus success is a busy application. Build your logic around both halves.
The legitimate scanners to allowlist first
Here is the uncomfortable truth: your own network almost certainly contains several hosts that sweep and port-scan on purpose, every day. Turn on a scan alert before you have identified them, and the first week of alerts will be entirely about your own tools. Do this step before writing a single rule. In roughly descending order of how often they surprise people:
Your monitoring system's auto-discovery
Network monitoring software finds devices by sweeping address ranges and probing for management protocols. That is a host sweep by definition, and often a small port scan on each responding address as well. It usually runs on a schedule (nightly or weekly) from the monitoring server or its remote probes. Allowlist the monitoring server and every probe by name, and note the schedule so a discovery run that fires at an unexpected hour still looks odd.
Vulnerability scanners
If your organization runs vulnerability assessment tooling — internally or through a provider — it performs the most aggressive scanning on your network. It does this on purpose, against systems you are authorized to test. It should be the easiest to identify because someone scheduled it. Confirm the scanner's address, its schedule, and its target scope, and allowlist exactly that. A scan from the scanner's address outside its schedule or scope is worth a question; someone may have borrowed its credentials or its host.
Printer, asset, and device discovery tools
Print management consoles sweep for printers. Asset inventory agents sweep for anything. Some deployment tools probe every address they can reach to see what is installed. Desktop management suites do a bit of all three. Each one lives on a server you can name, and each one has a documented port list.
Backup and replication software
Backup servers probe their clients before a job starts to see which ones are reachable. Some probe more than one port per client to pick a transport. Forty tiny connections at 11 PM from the backup server is Tuesday. The same forty from the receptionist's desktop is not.
Directory, naming, and building infrastructure
Directory servers, DHCP servers, and name servers all have legitimate reasons to touch many hosts, though typically as responders rather than initiators. Building-automation controllers and IoT gateways poll their devices in ways that can look like sweeps of a small range. Those are covered in chatty device detection. The same advice applies: identify the controller and allowlist by role.
The allowlisting principle from the rest of this topic applies with extra force here: allowlist by identity and scope, not by bare address. An entry should say "the vulnerability scanner, from its host, during its window, against its target ranges." Anything outside those bounds — the same source at a different hour, or against a subnet it has never been pointed at — should still surface.
Tip: keep a short written register of every host on the network that is permitted to scan, with owner, purpose, schedule, and scope. It doubles as your allowlist source and as the first thing you check when an alert fires. If a host is not on the register and it is scanning, the answer to "should it be?" is already no until proven otherwise.
Alerting logic that holds up
Scan alerting is one of the few anomaly detections that works well with simple counting rules, because the signature is so distinct. Three rules cover most cases.
Rule 1: distinct destinations per source per minute
For each source, count the number of distinct destination addresses it initiated connections to in a one-minute window. Compare that to the host's own typical value and to its peers. A workstation that normally touches five distinct addresses a minute and suddenly touches a hundred and twenty is sweeping. Weight the count by failure: distinct destinations where the flow carried almost no data or the firewall denied it is far more specific than distinct destinations alone.
Rule 2: distinct ports per source-destination pair
For each pair, count distinct destination ports in a window. Almost every legitimate pair uses fewer than a handful. A pair touching dozens of ports in a minute is a port scan. The count needed to be confident is low. So this rule rarely misfires once the register of permitted scanners is subtracted.
Rule 3: deny-log fan-out
On the firewall, count denied connections per source per minute, then count the distinct destinations or ports among them. A burst of denies from one internal source toward many internal destinations is the single clearest scanning signal you can get. A legitimate application knows where its servers are and does not generate denies by the hundred.
Here is an illustrative sketch of rule 1 as pseudo-SQL against a flow table. As always, it is a diagram of the logic rather than a script to paste.
-- Illustrative: sources fanning out to many destinations
-- with mostly failed (tiny) flows, per one-minute bucket
SELECT src_host,
date_trunc('minute', start_time) AS minute,
COUNT(DISTINCT dst_addr) AS distinct_dsts,
SUM(CASE WHEN packets <= 2 THEN 1 ELSE 0 END) AS tiny_flows,
COUNT(*) AS total_flows
FROM flows
WHERE start_time >= now() - interval '15 minutes'
AND dst_is_internal = true
GROUP BY src_host, date_trunc('minute', start_time)
HAVING COUNT(DISTINCT dst_addr) >= 50
AND SUM(CASE WHEN packets <= 2 THEN 1 ELSE 0 END) > 0.8 * COUNT(*)
ORDER BY distinct_dsts DESC;
The two thresholds — fifty distinct destinations and four-fifths tiny flows — are starting points to tune against your own network, not universal constants. A small office subnet may warrant a lower destination count; a data center segment full of service meshes may need a higher one.
Whatever the thresholds, add a confirmation window before anything pages a human. A single one-minute bucket over the line should log. Two consecutive buckets, or three within ten minutes, should raise a reviewable alert. A source that stays over the line for five minutes, or that crosses it on multiple subnets, should page. Sweeps are fast, so the windows can be short, but the tiering keeps a single misconfigured application from waking anyone up. The tuning guide covers the promotion of rules from log-only to paging in detail.
Reading a firewall deny log for fan-out
Even with no flow collector at all, a firewall's deny log tells the story if you know how to read it. The format varies by vendor, but nearly every one records a timestamp, an action, a source address and port, a destination address and port, and a protocol. Here is an illustrative excerpt in a generic format:
02:14:07 DENY tcp 10.20.5.77:49212 -> 10.20.8.1:445 02:14:07 DENY tcp 10.20.5.77:49213 -> 10.20.8.2:445 02:14:07 DENY tcp 10.20.5.77:49214 -> 10.20.8.3:445 02:14:07 DENY tcp 10.20.5.77:49215 -> 10.20.8.4:445 02:14:08 DENY tcp 10.20.5.77:49216 -> 10.20.8.5:445 02:14:08 DENY tcp 10.20.5.77:49217 -> 10.20.8.6:445 02:14:08 DENY tcp 10.20.5.77:49218 -> 10.20.8.7:445 ... 02:14:31 DENY tcp 10.20.5.77:49459 -> 10.20.8.248:445
Read it the way the night manager reads the hallway camera. One source: every line comes from 10.20.5.77. Sequential destinations: the target address climbs by one on each line, straight through the subnet. One port: every attempt is to the same service, in this case the file-sharing port, which tells you what the host was looking for. Sequential source ports: the source port also increments by one, the fingerprint of a single process opening connections in a tight loop. Compressed time: the whole subnet was covered in under thirty seconds. The hour: 02:14 on a workstation subnet.
That is a host sweep, and you could identify it with nothing but a text editor and a sort. A port scan reads the same way with the columns swapped: one source, one destination, and the destination port climbing line by line. A chatty application, by contrast, produces denies that are scattered in time, aimed at a couple of destinations, and repeated identically from every host that runs the application.
Two cautions when reading deny logs. First, the firewall only sees what crosses it. A sweep confined to a single subnet never reaches the perimeter firewall. That is a strong argument for enabling host firewall logging on servers and for collecting flows from internal switches. Second, a source address in a log is a lease, not an identity. Before you accuse a machine, tie the address to a hostname and a MAC through your DHCP and switch records for that exact time.
The response: identify, verify, isolate, preserve
An alert fires, or you find the pattern in a log. Everything from here is defensive and procedural. Work down the list; do not skip ahead to cleaning the machine.
- 1. Identify the host. Turn the source address into a name. Check the DHCP lease at that timestamp, the switch port it hung off, the asset inventory, and who is logged in or assigned to it. Write all of that down before anything changes.
- 2. Check the register. Is this host permitted to scan? Is it the monitoring server, the vulnerability scanner, a deployment tool? If yes, is it within its schedule and scope? If everything matches, close the alert and, if it was not on the allowlist, fix that. If anything does not match, continue.
- 3. Ask the owner — carefully. If it is a user's machine, a quick "did you run anything unusual around 2 AM?" often resolves it. The cause might be a curious new hire or a tool someone downloaded to map printers. If the owner is baffled, or the host is a server nobody should be logged into at that hour, treat it as suspect.
- 4. Isolate, don't power off. Move the host to a quarantine network, shut its switch port, or block it at the nearest firewall from everything except your response tooling. Powering off destroys what is in memory, and whoever investigates next may need it.
- 5. Preserve the logs. Export the deny-log lines, the flow records, and the DHCP and switch records for the window, plus an hour on either side. Store them somewhere the host cannot reach and note who exported them and when.
- 6. Check what answered. A sweep's successes matter more than its failures. From the same records, list every destination that did reply with a real conversation. Those hosts are your next concern, because they are the doors that opened.
- 7. Escalate with a timeline. Hand the package — identity, register check, owner's answer, isolation time, preserved logs, list of responders — to whoever owns security response. Keep the timeline to one page. Responders love a clean timeline more than any other gift.
- 8. Feed it back. Whether the outcome is "new hire with a printer-finder" or something worse, record it. Innocent outcomes become register entries or threshold adjustments; real ones become the case for better segmentation.
Step six deserves one more word. Scanning is reconnaissance; it is what a host does before it does something else. The value of catching it early is that you often get there before the "something else." The list of hosts that answered tells you exactly where to look next. The pattern to fear most starts with a sweep. A few minutes later, the scanning host makes a long, successful connection to one of the responders. And that pattern is visible in the same flow records you already pulled.
Where to go next
You can now recognize both shapes of internal scanning: one source to many destinations, or one pair across many ports. Their four fingerprints are fan-out, tiny failed connections, sequential targets, and a compressed window. You know to build the register of permitted scanners before writing a rule. You know how to count distinct destinations and ports with a confirmation window. You can read a deny log like a hallway camera and respond in order without destroying evidence.
Scanning is one of the loud patterns in the Detecting Traffic Anomalies topic. Its quiet counterpart is beaconing, where a host talks to one outside controller on a schedule. The two frequently appear on the same host in sequence. For the framework that puts both into context — the five anomaly dimensions and the six triage questions — start with what counts as a network anomaly.
Put this into practice with SysPeep Monitor
One of the first scanners you'll need to allowlist is your own monitoring system's discovery. So it helps when that discovery is predictable and well documented. SysPeep Monitor auto-discovers devices and interfaces from a central Windows service and optional remote probes, on a schedule you control. It shows the results on live maps and dashboards, so you know exactly which sweeps are yours. Try it free from the download page.
Download Free TrialLearn About SysPeep