Reading width
Wide uses the full column for everything, text, diagrams, code, and exercises. Narrow keeps the standard reading width.
Text size
Scales the body text. Headings and code blocks keep their size.
In this section
Network Forensics of Scanning: Port States, Web Scanners, Exposure and Verification
Introduction
Anything published to the internet is scanned, constantly, by research projects, commercial services, criminals and tools nobody bothers to identify. For an investigator the scanning itself is rarely the story. The story is what the scanning found: which services were reachable, which pages answered, and whether anyone came back to use them.
Three sources fire bursts; five take turns; one probes slowly through the whole window; two browse the site; one names itself and leaves.
This lesson reads a quarter of an hour of the lab's DMZ web server, portal.example.com, as twelve outside sources reached it through the firewall, then a second window after the server was hardened and scanned again. It uses the firewall's log, captures and Zeek logs on both sides of the firewall, and the web server's access log. Module 7 teaches each part in depth.
The Firewall Sees It First
Denied and allowed, by portThe firewall forwards ports 22, 80 and 443 to the server and drops everything else, logging both. Its log for the window:
$ grep -c DENY-IN firewall.log; grep -c ALLOW-IN firewall.log
grep DENY-IN firewall.log | grep -o 'DPT=[0-9]*' | sort | uniq -c \
| sort -rn | head -5
1063
144
7 DPT=3389
6 DPT=8080
6 DPT=53
5 DPT=161
5 DPT=123
1,063 packets were denied and 144 connections allowed. The allowed lines are new connections to the three forwarded ports. The denied lines are probes to everything else, and the ports at the top of the denied list are services this server does not publish, such as 3389, the remote desktop port.
The firewall log answers the first question, what reached the boundary, but with limits. It records one line per packet the rule matched rather than one per connection, so a scanner that retries looks busier than it was. It records nothing about what happened after a packet was allowed: whether the server answered, what it said and what was requested.
And it records only what the rules were written to log; a rule that drops silently leaves no trace at all. This firewall logs both, through NFLOG, so its view is as complete as a firewall's view gets; many log only what they deny, or only what they allow, and some log nothing by default.
Those limits matter in both directions. A count of denied packets measures how much of the internet's background noise reached this address, which is not a measure of risk.
The allowed lines, few as they are, are where anything that matters will be, because those are the connections that reached a service. The rest of this lesson reads the allowed connections, and the denied ones only where they help tell sources apart.
The firewall's own rules are worth reading alongside its log, because they say what the log can contain. Here they forward 22, 80 and 443 to one address and drop the rest. A connection to any other port cannot appear among the allowed lines, and a connection to 22 that was allowed says nothing yet about whether the server answered; that takes the connection records on the far side.
Port States from Connection Records
What the answer to a SYN says203.0.113.200 sent probes to 1025 ports in about fifteen seconds. Zeek's documentation gives the meaning of each connection state, and the three ports that answered differently from the rest show all three outcomes:
$ zeek-cut id.orig_h id.resp_p conn_state history < zeek-outside/conn.log \
| grep 203.0.113.200 | grep -v S0
203.0.113.200 22 REJ SrR
203.0.113.200 80 RSTO ShR
203.0.113.200 443 RSTO ShR
203.0.113.200 22 REJ SrR
203.0.113.200 80 RSTO ShR
203.0.113.200 443 RSTO ShR
The same exchanges as a sequence, from the scanner through the firewall to the server:
A scanner sends a SYN and reads what comes back. The server answers SYN-ACK on 80 and 443, the scanner resets, and the record is RSTO; on 22 the server resets, and the record is REJ; on most ports nothing answers, and the record is S0.
Each exchange leaves one connection state, and the states sort every port a scan touches:
What a connection record says about a port
Open: something answered
Closed: reachable, nothing listening
No answer: filtered, or nothing there
On 80 and 443 the server answered SYN-ACK and the scanner reset the connection without completing it: RSTO, established and aborted by the originator, which is the shape of a half-open scan. On 22 the server answered with a reset: REJ, the attempt rejected.
That port is forwarded by the firewall, so the probe reached the server, and nothing was listening there. On the other 1,022, nothing answered at all: S0, attempt seen, no reply, because the firewall dropped them.
Those are the three states every scan sorts ports into, read from the target's side: open, closed and no answer. The distinction between closed and no answer is easy to miss and important. A closed port is reachable: the firewall let the packet through and the host itself refused it.
Port 22 was not serving anything, but it was exposed, and the day something starts listening on it, it is open to the internet. A sweep that reported 22 as closed told its operator exactly that. An inventory that lists only open ports misses it.
Reading states from the target's records rather than the scanner's report is what an investigator does, because the scanner's output is never available. The records are the same either way: the connection log shows every question the scanner asked and every answer it got.
The history column adds the detail, in letters Zeek's documentation defines, capitals for the originator and lower case for the responder: ShR on 80 and 443 is the scanner's SYN, the server's SYN-ACK and the scanner's reset, and SrR on 22 is the scanner's SYN, the server's reset, and a reset from the scanner after it.
Module 7's first lesson reads every scan type this way, from the target's records, and shows why a UDP scan is so much harder to read than a TCP one: a UDP port that receives a probe and says nothing looks the same as one that never received it.
Telling the Sources Apart
Volume, ports, timing and what they call themselvesTwelve addresses reached the server. They differ in how many connections they made, how many ports they tried, how fast and what they said they were. The web sources name themselves in the user agent:
$ zeek-cut id.orig_h user_agent < zeek-dmz/http.log | sort -u \
| cut -c1-80
203.0.113.201 Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/b
203.0.113.202 Mozilla/5.00 (Nikto/2.1.5) (Evasions:None) (Test:Port Check)
203.0.113.204 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM
203.0.113.205 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM
203.0.113.210 ResearchScan/1.0 (+https://scan.example.org/about)
User agents are claims, and a scanner can send any string; but most do not bother to hide, and the ones here match what each source did. Sources fall into a few kinds:
Who scans, and what they leave
Many ports, few or no payloads
Few ports, many requests, a tool's user agent
Spread across addresses or time to stay under thresholds
Read together with the connection counts, the window sorts into a few kinds. 203.0.113.200 is a sweep: over a thousand ports in seconds, half-open, no requests. 203.0.113.201 is a service scan: a handful of ports, completed connections and HTTP requests from the Nmap Scripting Engine, which is how a scanner identifies what is listening once it knows a port is open.
203.0.113.202 is a web scanner, nikto by its own user agent, with thousands of requests to one port. 203.0.113.210 is a research scanner that names itself and its project page and makes three connections.
Two kinds are designed not to stand out. 203.0.113.211 to 215 each made five connections to the same five ports, 22, 80, 443, 3389, 8080, starting a few seconds apart: five addresses taking turns, which looks like five small events to a threshold counting per source and like one scan to anyone grouping by behavior.
203.0.113.216 spread twenty-one connections over 120 seconds, slow enough to fall under a rate threshold. Module 7 groups sources by port set, packet shape and timing, and shows which of those keys is strong enough to tie addresses together.
Two sources, 203.0.113.204 and 205, are neither: they requested the home page a few times over the whole window with a browser's user agent, which is what visitors do. They matter to the analysis precisely because they are ordinary: any method that flags them as scanners will flag every customer.
Separating the window's twelve sources into sweeps, service scans, web scans, quiet scans, a research project and two visitors is the first half of an assessment. The second half asks what each one found.
What a Web Scanner Leaves
Thousands of 404s, and one 200 that matters203.0.113.202 made 6,296 HTTP requests in about ten seconds. The web server's log, read by status code, and the one request that mattered:
$ grep 203.0.113.202 web-access.log | cut -d'"' -f5 \
| awk '{print $1}' | sort | uniq -c | sort -rn
grep '"GET /tools/ HTTP' web-access.log | awk '{print $1, $2, $5, $7}'
6154 404
64 200
56 400
20 501
2 405
203.0.113.202 [2026-11-10T12:31:03+00:00] /tools/ 200
Almost every request returned 404. That is what a generic web scanner looks like: it tries a long list of paths that have been dangerous on some server at some time, old CGI scripts, administration pages and known vulnerable applications, and nearly all of them are absent here.
The requests themselves are alarming to read, script injections and remote file includes among them, but a 404 means the server had nothing at that path, and the request did nothing. Reading the payloads one by one would take hours and conclude nothing; the status codes summarize them in one command. The few that did not return 404 are worth reading individually, and they are few enough to read.
The 200s need one more step. Sixty-three of the sixty-four were the home page, requested with a query string or extra slashes the site ignored, so they returned the ordinary page and found nothing.
The sixty-fourth is the finding. /tools/ answered with a page, and the server was not supposed to publish it: the lab's notes record that the hardening afterwards removed it from the public site. A scanner with no knowledge of this server found it simply by asking, which means anyone else could have too. It also means the finding is only as old as the scan.
If the page had been published for months, every scanner that ran nikto or something like it in that time found it too, and the access log is the only record of who asked. On this server the log covers the whole window; on a real one, its retention decides whether the question can be answered.
That is the habit for web scans: count the statuses, then read the exceptions. A 200 or a 3xx on a path that is not part of the site, a 500 that suggests a request reached code it should not have, a 401 that reveals an authentication prompt nobody knew about. Each one is a question about exposure, answered by the server's own content rather than by the scanner's intent.
Module 7's lesson on suspicious requests reads all of them, and how to tell a probe that failed from one that reached something.
What Was Actually Exposed
The inventory the scans producedThe volume of a window like this invites one mistake before any other:
The reasonable mistake
Treating every scan as an attack on you
An analyst sees 1,063 denied packets in a quarter of an hour and opens an incident for each source. Most of the window is port sweeps and generic checks that probe every address on the internet the same way.
Instead: Grade each source by what it did against this server: whether it found anything, whether it came back for it, and whether it tried to use it. The one that requested a page the site was never meant to publish matters more than the one that sent a thousand SYNs.
Taken together, the window answers a question the organization should have been able to answer before any of it: what does this server expose to the internet? From the records alone:
Ports 80 and 443 were open, serving the site. Port 22 was reachable and closed, forwarded by the firewall to a host with nothing listening on it. The site published /tools/, a page outside its intended content. Everything else was dropped at the firewall.
That list is an exposure inventory, built from the attacker's side by reading what the attackers saw. It is often more accurate than the one in the asset register, because it is built from what the server actually answered rather than what someone intended it to answer.
It also ranks the findings by consequence: the closed port is a configuration error waiting to become an exposure, and the published page is an exposure already. Neither finding came from a vulnerability scanner's report or a configuration audit. Both came from records the organization already kept: a connection log on the internet side and the web server's access log.
That is the practical point of this module for an investigator: the exposure inventory can be rebuilt from network evidence at any time, without asking anyone what they deployed.
The grading of sources follows from it. In this window no source came back to /tools/ after finding it, and none tried to use anything; Module 7's assessment lesson records exactly that, source by source, grading each by how far it went, from mapping the server to targeting what it found to trying to use it.
A scan that found nothing is noise. A scan that found something is a lead, and the question becomes whether anyone followed it.
The same method applies to any internet-facing server: list what answered, from the connection and server records, before reading what the scanners intended. The intent is guesswork; the answers are on record. Write the inventory as a list of answers with the record that shows each one, so that the fix in the next section can be checked line by line.
Closing It, and Checking
A second scan proves the fixAfter the first window, the firewall stopped forwarding port 22, /tools/ was removed and the server was set to return one plain error page for every error status. Then the organization's own scanning service, 203.0.113.240, scanned the server again. Port 22 now:
$ zeek-cut id.orig_h id.resp_p conn_state < zeek-outside-after/conn.log \
| grep -w 22
203.0.113.240 22 S0
203.0.113.240 22 S0
S0: no answer. The firewall no longer forwards the port, so the probe is dropped before it reaches the server, and from outside it is indistinguishable from any other filtered port. Before the change the same probe drew a reset from the server itself. And /tools/:
$ grep '"GET /tools/ HTTP' web-access-after.log | awk '{print $1, $2, $5, $7}'
203.0.113.240 [2026-11-10T12:33:03+00:00] /tools/ 404
404, the same answer as any path that does not exist. Both fixes are confirmed by the records of a scan run after them, which is the only confirmation that counts: a change ticket says what someone intended, and the second scan says what the internet can now see. The second scan was run by the organization's own service, from the outside, through the same firewall the attackers used.
A scan from inside the network would have reached port 22 on the server directly and proved nothing about what the firewall now forwards; the vantage point has to match the exposure being tested. The same is true of timing: a check run minutes after a change proves the change took effect, and a check repeated on a schedule proves it stayed in effect.
Verification matters because fixes fail quietly. A firewall rule added in the wrong order, a path removed from one server behind a load balancer and not another, an error page that still leaks the application's own message: each looks fixed in the change record and still shows up in a scan.
Module 7's lesson on closing and verifying reads the before and after windows side by side, port by port and path by path. It also checks the one plain error page: before the change, a missing path could produce an error the application itself wrote, with its own wording and size; after it, every error is the same short page, which leaves a scanner less to fingerprint.
What Module 7 Builds On It
Reconnaissance and exposure in depthModule 7 starts with port states and scan types read from the outside, then service discovery and fingerprinting, suspicious requests, and the low and slow scans this lesson only pointed at. It turns those into an external exposure inventory, closes and verifies it, and grades every source in an assessment.
Its exercise is Case 3: research and mass scanners, a distributed scan, a slow scan and one source that maps every port and then concentrates on the server, to be separated from the noise and graded by what each did.
Module 7, in order
The lab is the same: both windows, both sides of the firewall, the firewall log and the server's log. Nothing has to be captured again. Case 3 brings its own window, with its own sources, and the method is the one this lesson has walked through: list what answered, group the sources, read the exceptions, and grade each by how far it went.
The exercise asks for the grading to be written down with the record behind each grade, the same discipline the exposure inventory asked for. The answers are in the Phase 0 answer guide, so the grading can be checked once it is written rather than before.
The habit to carry into it is to read a scan from the target's records, by what it found rather than how loud it was. Sort the answers into open, closed and no answer; read web scans by their exceptions; group sources by behavior, not address; and confirm every fix with a scan of your own.
None of it requires knowing which tool a scanner ran. Its records say what it asked and what it was told, and that is what the assessment is built from. A tool name helps explain a pattern; it never replaces reading what the pattern did against this server. A port sweep sends no user agent at all, and it is graded by the same records as every other source.
Practice
Who scanned, and what did they find? the lab DMZ serverThe prepared evidence below summarizes every source that reached the server in the first window: its connections, ports, states, duration and user agent. Find the full sweep, the scan split across five addresses, and the source that found a page the site was not meant to publish. Each answer comes with its reasoning, so check it against the rows.
The States column uses Zeek's connection states, so read it with the three answers from section 2 in mind: open, closed and no answer. Duration matters as much as volume; a source that took two minutes over twenty connections is doing something different from one that took two seconds. Read both before deciding.
If you run a server on the internet, read its connection or access log for a day and sort the sources the same way. Most will be sweeps and generic checks. The ones worth reading are those that got an answer other than a refusal.
Scanning is constant and mostly noise; what matters is what answered. Connection states read the answers: open, closed and no answer. Web scans are read by their exceptions, sources are grouped by behavior because a scan can be split across addresses or spread over time, the records of what answered make an exposure inventory, and a second scan is the only proof that a fix worked.
The next lesson moves inside the network, to a compromised host calling home: finding the beacon.
Versions this lesson relies on: Zeek 9.0.1 (LTS).