Open-Port Drift: Alerting When Exposure Changes
A single exposure scan is a photograph. It tells you what your perimeter looked like on one quiet evening, and it is useful for exactly as long as nothing changes. Then someone adjusts a firewall rule to help a colleague work from home. Or a cloud engineer opens a security group "just for the afternoon." Or a vendor's appliance updates itself and switches on a management port. The photograph is now wrong, and nobody took a new one.
The answer is not to stare at scan reports every week hoping to notice a difference. It is to write down what is supposed to be open. Then compare every scheduled scan against that list automatically, and be told only about the differences. That is drift detection, and it turns the exposure scan from a one-off audit into a monitor. It is quiet when nothing changes, loud the moment your public face changes shape.
This guide shows how to build it for the addresses your organization owns and is authorized to scan. You will define a baseline of expected open services and diff each scan against it. You will alert on anything new and anything missing, and tie each drift to the change that caused it. You will follow a short workflow that ends with either an updated baseline or a closed door. Everything here is about your own perimeter; the scans it relies on are the authorized, scoped ones described in the exposure scanning guide.
In this guide
- The baseline: a small list, written down
- Diffing each scan against the baseline
- Alerting on new exposure
- Alerting on vanished services
- Correlating drift with change records
- The drift-alert workflow
- Drift types, likely causes, and responses
- Keeping the baseline honest and the alerts quiet
- Where to go next
The baseline: a small list, written down
A baseline is the list of open ports you expect on each public address, with a service name and an owner beside each one. The word "small" in the heading is not decoration. A well-run perimeter has a short baseline. It includes a firewall with its VPN ports, a web server with two web ports, a mail gateway with three mail ports, and a handful of others. If your baseline runs to pages, that is itself a finding, and the program guide covers how to shrink it over time.
The baseline must be a file, not a memory or a shared understanding. Drift detection is a comparison, and a comparison needs two concrete things to compare. A plain text format works best, because plain text is easy to diff, easy to version, and easy to read at three in the morning:
# baseline.txt - expected open ports on addresses we own # reviewed by: (name) on: (date) scope: scope-v3.txt # address port/proto service owner 203.0.113.1 500/udp vpn netadmin 203.0.113.1 4500/udp vpn netadmin 203.0.113.2 80/tcp http-redirect webteam 203.0.113.2 443/tcp https webteam 203.0.113.3 25/tcp smtp mailadmin 203.0.113.3 443/tcp webmail mailadmin 203.0.113.3 587/tcp submission mailadmin 203.0.113.5 - none-expected netadmin 203.0.113.6 8443/tcp vendor-mgmt facilities (ticket 1182: restrict to vendor addresses)
Notice three things. Every line has an owner, so a drift alert can go to a person instead of a mailbox nobody reads. The address that is supposed to be silent is listed explicitly, so a port appearing on it is unmistakably drift. And the vendor box is present with a ticket reference: the team decided to keep it, restricted. So its one management port is expected until the ticket says otherwise. A baseline records decisions, and every line should be traceable to one.
Tip: Keep the baseline in version control alongside the scope document. When someone asks "since when has port 8443 been expected on that address?", the commit history answers in seconds, with the name of the person who approved it.
Diffing each scan against the baseline
Once the baseline exists, the scheduled scan becomes a producer of one thing: a current list in the same format. Normalize the scanner's output into the same address port/proto shape, sort both files, and compare. The mechanics are deliberately boring, because boring mechanics run reliably at four in the morning. A few lines of script are all it takes. Extract the open ports from the scan, write them to current.txt, and run a plain text diff against the baseline's address-and-port columns.
Here is what the output looks like on a night when something has changed. Lines beginning with a plus sign are present in the current scan but absent from the baseline. Lines beginning with a minus sign are in the baseline but missing from the scan.
$ diff baseline-ports.txt current-ports.txt --- baseline-ports.txt (scope-v3, reviewed by netadmin) +++ current-ports.txt (scan from 192.0.2.77, slow profile) +203.0.113.1 3389/tcp open ms-wbt-server (remote desktop) -203.0.113.3 587/tcp open submission +203.0.113.6 22/tcp open ssh (vendor build string) +203.0.113.9 22/tcp open ssh +203.0.113.9 5432/tcp open postgresql
Five lines, and each one is a story. Remote desktop has appeared on the firewall's public address. The mail gateway's submission port has vanished. The vendor box now answers on a remote-shell port in addition to its approved management port. And an address that was not even in the baseline, 203.0.113.9, is answering on a shell port and a database port. A human reading the full scan report might have missed two of these among the expected lines. The diff makes them impossible to miss, because it contains nothing else.
Two rules keep the comparison trustworthy. First, the scan must use identical settings every run: same vantage point, same port list, same timing profile. Change the port list and every newly probed port that happens to be open shows up as drift that is really just wider coverage. Second, treat a scan that failed or was cut short as "no result," never as "everything closed." A scanner blocked halfway by your own intrusion prevention would otherwise report the entire baseline as vanished. And you would spend the morning chasing a ghost.
Alerting on new exposure
A plus line is the classic drift, and it deserves an alert every time. A new open port on a public address is a new door, and doors do not open themselves. The stories behind the plus lines above are the three ways it usually happens.
The firewall change that exposed remote desktop
A colleague needed to reach a workstation from home over the weekend. The quickest fix was a port-forward on the firewall to the workstation's remote desktop port, to be removed on Monday. Monday was busy. The rule is still there, and remote desktop reachable from the whole internet is one of the most-probed and most-abused exposures that exists. The drift alert is the only thing that will ever bring this rule back to anyone's attention, because from inside the building everything works fine.
The cloud rule opened "temporarily"
In a cloud account, reachability is governed by security groups and gateway configuration rather than a firewall appliance. A single rule allowing "all ports from anywhere" takes one click to add. The cloud networking basics guide explains how those layers decide what is reachable. The 203.0.113.9 lines in the diff are exactly this. A developer attached a public address to a database instance to run a quick migration, widened the group to make it work, and moved on. The database is now listening to the internet. Nothing in the developer's day told them that; the drift alert tells you.
The vendor box that turned on a management port
Appliances update themselves. A firmware update on the vendor's remote-access box enabled a remote-shell service that was previously off. Because the firewall rule for that box was written permissively ("allow anything to the appliance"), the new service is reachable from outside. Nobody in your organization changed anything, which is why this class of drift is invisible to change control and visible only to a scan.
For all three, the alert should carry enough context to act on. That includes the address, the port, the banner if one was collected, and the owner named in the baseline (or "no owner: address not in baseline"). The alert should also include a link to the scan record. An alert that says only "drift detected" makes the reader open three other systems before they can decide whether to worry.
Alerting on vanished services
Minus lines get less attention, and they should not. A service that is supposed to be reachable from the internet and suddenly is not means one of a few things. None of them are good. The service crashed, or a firewall change accidentally blocked it. Or a certificate or configuration problem is making it refuse connections, or your provider is dropping traffic. In the diff above, the mail gateway's submission port disappeared. That means every staff member who sends mail from a laptop outside the office is about to have a bad day. And the ticket will say "email is broken" with no further detail.
Vanished-service drift is where the outside-in view complements ordinary availability monitoring instead of duplicating it. Your internal monitoring probably confirms the mail service is running and listening on the LAN. It cannot tell you that a firewall rule now blocks it from the internet, because the monitor is on the wrong side of the firewall. The external scan can. Multi-location checks of web services, described in the external multi-location checks guide, are the same idea applied continuously to your website. The drift scan extends it, at a slower cadence, to every port in the baseline.
Route vanished-service alerts to the service's owner from the baseline, and mark them as availability rather than security. That way, they get the urgency of an outage rather than a place in the security backlog. A vanished port is often the first sign of a problem that will otherwise arrive as a flood of user complaints an hour later.
Correlating drift with change records
Every drift has a cause, and in a well-run organization most causes leave a record. That could be a firewall change ticket, a cloud audit log entry, a vendor's update notification, a change-control approval. The single most useful step after a drift alert fires is to line up its timestamp against those records. Ask what changed in the window between the last clean scan and this one. The change correlation guide covers that discipline in general. For drift, the practical version is to keep the scan schedule and the change calendar in the same place so the comparison is one glance.
The correlation also runs the other way, and this is the direction most small teams forget. Any change that touches the firewall, public DNS, or a cloud network rule should trigger a rescan, not wait for the weekly one. If the change was intended to expose something, the rescan confirms it and the baseline gets updated in the same ticket. If the change was not supposed to alter exposure, the rescan proves it. Either way the baseline never drifts far from reality, and the scheduled scan goes back to being the safety net rather than the primary detector.
When no change record matches a drift, that absence is itself information. Consider a port that opened with no ticket, no cloud log entry, and no vendor notice. That means either a change made outside process or something that happened without anyone at your organization acting. Both justify a closer look at the host before the port is simply closed and forgotten.
The drift-alert workflow
A drift alert should walk the responder through the same short sequence every time, whether it lands with the senior engineer or with you in your third week.
- 1. Verify. Confirm the drift is real. Re-check the port from the same vantage point, by hand if necessary. Confirm the scan completed and the address is genuinely in your scope. A drift that cannot be reproduced goes into the log as a transient. But two transients on the same port in a row deserve a closer look.
- 2. Identify. Work out what is behind the port. The banner, the baseline's owner column, the firewall's NAT and forwarding rules, and the cloud console together usually name the host and service within minutes. Do not skip this step: closing a port without knowing what it belongs to has a way of taking down something important.
- 3. Find the change. Line the drift up against change records, cloud audit logs, and vendor update notices for the window since the last clean scan. Name the change if you can, and name the person who made it, not for blame but because they know what the change was for.
- 4. Decide. The drift is either intended or not. Intended: someone meant to expose this, it has an owner, and the exposure is acceptable as-is or with a restriction (such as limiting the source addresses). Update the baseline, with the ticket reference, and close the alert. Not intended: close the port, by removing the rule or fixing the cloud group or turning off the service. Then rescan to prove it is closed. Then spend ten minutes on the question that actually improves things: how did this happen without anyone noticing, and what would have caught it earlier?
- 5. Record. Write the outcome down: what drifted, what caused it, what was decided, and when. This is the raw material for the metrics in the program guide and the evidence you will want when the same thing happens again.
For vanished services, steps 1 through 3 are identical and step 4 becomes an outage decision. Restore the service, fix the rule that blocked it, or, if the service was deliberately retired, remove it from the baseline.
Drift types, likely causes, and responses
The table collects the patterns that recur. A new administrator who knows these eight will recognize most of what the diff ever shows.
| Drift seen in diff | Likely cause | First response |
|---|---|---|
| New management port (remote desktop, remote shell, web admin, SNMP) on a listed address | Firewall port-forward added for convenience; appliance update enabled a service; permissive rule to a device | Treat as urgent; identify the host; close or restrict to known source addresses; find the change |
| New port on an address that was supposed to be silent | A NAT rule reused a spare address; a new device was given a public address | Identify what claimed the address; decide whether it belongs there at all |
| Entirely new address answering, not in baseline | Cloud instance or load balancer given a public address; new circuit; forgotten range came back into use | Confirm the address is yours; add to scope and inventory; assess every open port on it |
| Database or file-sharing port newly open | Cloud security group widened for a task; host moved to a public subnet | Urgent; restrict immediately; check the service's own logs for unexpected connections |
| Same port, different banner | Service replaced or upgraded; host behind the NAT rule changed; something else took the port | Confirm the new service is the intended one; update baseline with the new identity |
| Expected service vanished, host still reachable | Service crashed; certificate or configuration problem; firewall rule edited | Treat as availability incident; notify service owner; check firewall change history |
| Whole address vanished (no response at all) | Host down; provider issue; rule now dropping everything; address released | Confirm from a second path if possible; check with provider; decide whether the address is still yours |
| Everything vanished at once | Scan blocked by your own intrusion prevention; vantage host lost connectivity; scan cut short | Treat as a failed scan, not as drift; fix the scan; rerun before acting on anything |
Keeping the baseline honest and the alerts quiet
A drift monitor lives or dies on the quality of its baseline. Two failure modes are common, pulling in opposite directions.
The first is the rubber-stamp baseline, where every plus line gets added to the expected list because that makes the alert go away. Within months the baseline lists everything the scan has ever seen and detects nothing. The defense is procedural: a port is added only with an owner and a reason, ideally a ticket reference. Someone other than the person who opened the port must also agree to the addition. It takes two minutes and is the difference between a monitor and a diary.
The second is the stale baseline, where services are retired but their lines remain. So every scan produces the same minus lines and responders learn to ignore the alert. The defense is a periodic review, at the cadence the program guide sets, where each line is confirmed by its owner or removed. A line whose owner has left gets reassigned during that review, not discovered during an incident.
A few alerting habits keep the signal clean. Alert on the diff, never on the raw scan. Suppress alerts for drifts already ticketed and awaiting a fix, so a known vendor-box issue does not re-page someone every week. Send new-exposure alerts to whoever handles security, vanished-service alerts to the service owner, and both to the attack-surface owner. And make the weekly "no drift" result visible somewhere. Silence from a monitor that quietly stopped running looks exactly like silence from a perimeter that has not changed. A scan that does not report in on schedule is itself an alert condition.
Where to go next
You now have the piece that turns scanning into monitoring. The baseline is a short, owned, version-controlled list of what should be open on each public address you control. Every scheduled scan is diffed against it, and only the differences are surfaced. Plus lines mean a new door, urgent when the door is a management interface or a database. Minus lines mean a service you rely on is no longer reachable, and are handled as outages. Each drift is tied to the change that caused it and ends with either an updated baseline or a closed port and a lesson about how it opened.
The DNS and certificate guide applies the same baseline-and-diff thinking to your public records. There, drift shows up as a new subdomain or a certificate you did not issue. The program guide sets the cadence for scans and baseline reviews and shows how to track findings so nothing the diff surfaces gets lost. If you arrived without the foundations, Seeing Your Network the Way Attackers Do explains why the baseline has to be built from the outside in. Everything in this series lives under External Attack Surface Monitoring.
Put this into practice with SysPeep Monitor
Drift detection tells you a door opened or closed on your perimeter; the inside view tells you what is behind it. SysPeep Monitor discovers the devices and interfaces on your network. It watches the firewall and the servers behind your public addresses over SNMP, WMI, and SSH. It also uses thresholds and dependency-aware alert rules to tell you when something changes without burying you in noise. When a vanished-service alert fires, that inside health data is the fastest way to tell a crashed service from a blocked one. The free trial installs on a Windows machine in minutes.
Download Free TrialLearn About SysPeep