Security: how best to test for port vulnerability
The other day I was playing around with the Network Utility in OSX and decided to try the Port Scan tab. I was surprised when it gave the following as being open TCP ports:-
22 ssh
23 telnet
80 http
139 netbios-ssn
445 microsoft-ds
30005
44401
Now, although I'm very security-conscious I'm no expert when it comes to securing TCP or UDP ports, but a little asking around revealed that these were ok results. Apparently, in addition to the NAT translation, there's a firewall in my router that blocks all unsolicited incoming connections, and this port scan was, in any event, probably an internal test scan, rather than one organised from the Internet.
These comments eased my mind, but one contact has subsequently asked whether OSX really does perform this from the LAN side of the router. An alternative would be for OSX to make a connection with an Internet-based server, requesting that server to perform an external scan of the WAN IP address. If this were the case, then this puts a very different light on the results.
So, does anyone in these forums know how 'Port Scan' in Network Utility performs its test? Can we be 100% certain that it does it in the direction Mac to router, rather than Internet to router?
Clearly, if the majority of these are actually open, as seen from the Internet, then there's huge cause for concern. About the only one I recognise there as being possibly valid is port 80. As for 30005 and 44401, they don't seem to even appear on any official port listings and indeed when I later repeated the scan they disappeared from the result.
I might add that I've got the OSX Firewall set up to block all incoming connections and it's also in stealth mode. Signed software is not automaticaly allowed on incoming connections. I run no other firewall or any antimalware.
I've found nothing on my Mac that explains exactly what happens when OSX performs this scan. Has anyone else ever found a description of any sort?
It's been suggested that I use a website like Shields Up to specifically test from the Internet side and although many years ago I used SU from time to time for testing a Windows machine, these days I'm less willing to use my IP address at any website. Am I being paranoid, or actually sensible? Is OSX Port Scan definitely executed internally?
Sometimes, endeavouring to be totally invulnerable can get you into deep water, so I want to avoid that if at all possible. For example, I highly suspect that if I were to block port 23, I'd probably find I could then no longer run my router's GUI. There's no immediately obvious means of blocking port 23 anyway, and my guess is that blocking some or all of these ports from being open access to my Mac would be possible only via a Terminal modification.
iMac (27-inch, Late 2013), OS X Mavericks (10.9.5)