I port-scanned my own network
I ran a full port scan of my home network and a package audit on the host that runs my automation. What each one covers, what it leaves out, and how patching took down a service that had been running fine.
If you run anything at home beyond a laptop and a phone, scan your own network from the inside and read the whole result. On June 4 I ran nmap across my home network from one of my own machines. The first number it gave me changed how I think about the phrase "it is only on my LAN."
What I ran
It was two passes. The first found every live host on the network. The second ran against the handful of machines that host services and checked every TCP port on each, all 65,535 of them, reporting only the open ones.
I used nmap's TCP connect scan. The nmap documentation describes it as the scan type used "when a user does not have raw packet privileges," and explains that nmap "asks the underlying operating system to establish a connection with the target machine and port." It is, in the documentation's words, "the same high-level system call that web browsers, P2P clients, and most other network-enabled applications use."
That last part is why I like it for this job. A connect scan needs no special privileges. So an open port in its report is a port that any ordinary program, on any device on the network, could connect to.
One rule before you copy me. Scan networks you own. The nmap project's own advice on the subject is blunt: "Ensure that you have permission to scan." At work, get that permission in writing before you start, even if the network is your responsibility.
Eighty-two hosts
The first pass found 82 live hosts.
I administer a small fraction of those. Most are IoT devices, the kind every house collects, running firmware I did not write and do not audit.
That number is why "only on my LAN" stopped being a comfort. A service that listens on the network is reachable by every device on the network. In my house that means 82 devices, and I can vouch for only a few of them.
The mechanism is simple and worth checking on your own machines. When a program opens a listening socket, it chooses an address to bind to. The Linux documentation for IP sockets says that when the wildcard address is used, "the socket will be bound to all local interfaces." The alternative is the loopback address, which "always refers to the local host." A service bound to loopback can be reached only from its own machine. A service bound to the wildcard can be reached from everything that can route to that machine. Many server programs default to one or the other, and you do not find out which until you look. On Linux, ss -tlnp lists every listening TCP socket with its bind address and the process that owns it.
The address always refers to the local host
Reachable only from its own machine
The socket is bound to all local interfaces
Reachable from everything that can route to that machine
My scan found 82 live hosts on my home network. I administer a small fraction of them.
What a scan from inside cannot see
A scan from inside the network answers one question: what can a device on this network reach. It does not answer two others.
It says nothing about what is reachable from the internet through the router. That needs a scan from outside, against your public address.
It also says nothing about what is reachable across a mesh VPN, where devices that are nowhere near the house are network neighbors by design.
So there are three surfaces, and I have scanned one. The other two are on my list. I am saying so because a clean result from one view tells you nothing about the others.
The findings
The scan gave me a ranked list. Some items on it are still open, and those stay in my notes until they are closed.
I can explain why they are not closed yet. Almost every fix of this kind has the same risk: something depends on the port you are about to close. Before I close or restrict anything, I need the full list of machines that connect to it today, and I need the replacement rules written and tested. If I skip that, the fix becomes the outage. I wrote in May about building the way back in before tightening anything, and this is the same discipline one layer down.
I ranked the list by how much an arbitrary device on the network could do, and I am working from the top.
The packages, which are fixed
The other half of the audit is closed, so I can be specific.
Since some time before the middle of May, a weekly vulnerability scan had been scheduled on the host that runs my automation. The timer existed. The script it was supposed to run had never been written. So every Sunday the job failed, and every Sunday my health monitor flagged the failure. I had a weekly alert telling me, accurately, that I had no vulnerability scanner.
I wrote the script on May 31. It checks four things: pending security updates from the operating system's package manager, known vulnerabilities in the Python packages my services use, the same for Node packages, and any listening port that is not on loopback, compared against a saved baseline. For Python it uses pip-audit, which its maintainers describe as "a tool for scanning Python environments for packages with known vulnerabilities." It stays silent when everything is clean, and sends one combined message when it finds something. It covers the one host it runs on.
The first real results came on June 4. I applied 120 package updates, 75 of them security fixes. I upgraded one Python HTTP library, which cleared nine known CVEs. On June 6 I updated five more Python packages, and the Python findings dropped from ten to four. The last four sit in two packages that a web framework pins to specific versions. They wait for a framework upgrade I want to test properly first.
The restart that broke something
The library upgrade only takes effect when the services using it restart. So I restarted the long-running services on that host, one at a time.
One did not come back. It crashed on start, again and again, because an environment variable it requires was missing. The variable held a shared secret.
The secret had been gone from the environment file since May 25. A deployment sync had overwritten the file on the server with a copy that did not have it. The service kept working for ten more days, because the running process had read the value when it last started and still held it in memory. The restart was the first time anything read the file again.
The old value could not be recovered. It was not in the file, not in any of the three backups and not in any running process. I was lucky in one respect. The same system both issues that secret and checks it, and nothing outside depends on it. I generated a new one, added it to the file, and the service started.
Two days later I compared the variable names in the server's file against the source copy the deployments come from. Three more existed only on the server, waiting for the same accident. I copied them back to the source.
I should have made that comparison before the restart. A process that has been running for weeks is still using the configuration it started with, and the file on disk may have changed underneath it. Before restarting anything that has been up for a long time, compare the two.
Sources
Views are my own.