What ports are open on my Mac, Linux, and Windows machines?
Here is how to see what ports are open listening on a server.
This is perhaps the most important potential vulnerability.
Having ports listening to outside traffic also takes CPU effort, which consumes electricity and thus reduce battery life.
PAT (Port Address Translation) maps ports.:
Port 3389 is used for communicating with Microsoft’s RDP (Remote Desktop Protocol) on Windows machines.
Common TCP Ports in layer 4: REMEMBER
Service |
TCP Ports |
UDP Ports |
---|---|---|
SMB |
445 |
445 |
NetBIOS |
137, 139 |
137, 138 |
LDAP |
389 |
389 |
LDAP over TLS |
636 |
|
Global catalog LDAP |
3268 |
|
Global catalog LDAP over TLS |
3269 |
|
NFS |
111, 2049, 4045, 1110 |
111, 2049, 4045, 1110 |
Kerberos |
88, 464, 543, 544, 749, 751 |
88, 464, 749, 750, 751, 752 |
RPC |
111, 135, 530 |
111, 135, 530 |
WINS |
1512, 42 |
1512, 42 |
DHCP |
67, 68, 546, 547 |
67, 68, 546, 547 |
Syslog |
601 |
514 |
Print services |
515 |
|
Telnet |
23 |
23 |
FTP |
21 |
21 |
SSH |
22 |
22 |
RDP |
3389 |
3389 |
MongoDB |
27017, 27018, 27019, 28017 |
|
SQL Server |
1433 |
1434 |
MySQL |
3306 |
|
PostgreSQL |
5432 |
|
Oracle |
1521, 1630 |
|
Elasticsearch |
9300, 9200 |
|
HTTP |
80 | 80 |
HTTPS |
443 | 443 |
123 = NTP (Network Time Protocol) to sync clocks
162 = UDP TRAP
1521 = Oracle SQL
2049 = NFS (Network File System) to share files between Linux machines
636/646 = Secure LDAPS via TLS (Transport Layer Security) pentest
445 = SMB (Server Message Block) from Azure Files
5900 = VNC (Virtual Network Computing) to remote control another machine
6667 = IRC (Internet Relay Chat) to chat with others
79 = Finger (not secure)
RTP (Real Time Protocol) to stream audio/video
88 = Kerberos (Windows)
Spring Boot:
IP header protocol field REMEMBER
Apple’s macOS Spotlight is like Window’s Search omni-box. *
Press Command+Spacebar.
Type the name of utilities that are buried, such as Network Utility.
Click the keyboard return/enter key to launch the Network Utility app.
Select the "Port Scan" tab.
Enter the IP (such as 127.0.0.1), localhost, or domain name you wish to scan for open ports.
Choose scan to see what ports the server responds to.
In a Terminal command line:
lsof -nP +c 15 | grep LISTEN
PROTIP: If you’ll be using this often, create an alias such as listening
.
“lsof” is a contraction for “list open files”. Without any options specifications, lsof lists all open files belonging to all active processes.
“-nP” is a combination of “n” for no resolution of IPs to hostnames using DNS and “P” for no resolution of Port names from numbers.
This is because the command already takes several seconds to run.
“+c 15” specifies command width of 15.
Piping to grep filters out only lines containing “LISTEN”.
A sample response:
rapportd 615 wilsonmar 4u IPv4 0xafaa508... TCP *:53150 (LISTEN) rapportd 615 wilsonmar 5u IPv6 0xafaa508... TCP *:53150 (LISTEN) ControlCenter 697 wilsonmar 14u IPv4 0xafaa508... TCP *:7000 (LISTEN) ControlCenter 697 wilsonmar 15u IPv6 0xafaa508... TCP *:7000 (LISTEN) ControlCenter 697 wilsonmar 16u IPv4 0xafaa508... TCP *:5000 (LISTEN) ControlCenter 697 wilsonmar 17u IPv6 0xafaa508... TCP *:5000 (LISTEN) Stream\x20Deck 1332 wilsonmar 13u IPv4 0xafaa508... TCP 127.0.0.1:28196 (LISTEN) AMPDevicesAgent 3340 wilsonmar 10u IPv4 0xafaa508... TCP *:49748 (LISTEN) com.docker.back 19614 wilsonmar 33u IPv4 0xafaa508... TCP *:53680 (LISTEN) com.docker.back 19614 wilsonmar 131u IPv6 0xafaa508... TCP *:8080 (LISTEN) com.docker.back 19614 wilsonmar 158u IPv6 0xafaa508... TCP *:5432 (LISTEN) com.docker.back 19614 wilsonmar 159u IPv6 0xafaa508... TCP *:8200 (LISTEN) com.docker.back 19614 wilsonmar 160u IPv6 0xafaa508... TCP *:1717 (LISTEN) vpnkit-bridge 19710 wilsonmar 8u IPv4 0xafaa508... TCP *:53680 (LISTEN) grafana-server 23515 wilsonmar 17u IPv6 0xafaa508... TCP *:3000 (LISTEN)
rapportd is Apple’s
AMPDevicesAgent may <a target=”_blank” href=”“>ask you for a password when you connect using USB the first time. It can cause 100% CPU usage. To avoid this, in iPhone Apple Music, uncheck the “automatically sync over wifi” box. To quit the process, go into Activity Monitor, find ‘AMPDevicesAgent’, select it and click on the information button, and quit the process. Then eject the iOS devices on Finder.
ControlCenter listens when “AirPlay Receiver” is turned on in System Preferences -> “Sharing”. Control Center stops listening to those ports when that’s turned off.
vpnkit-bridge goes away after Docker Desktop is stopped. The process is used by Docker Desktop under the hood. The process has caused 100% memory usage, and Fixed in Docker 2.3. It’s at file /Applications/Docker.app/Contents/MacOS/vpnkit-bridge.
grafana and other background services can be stopped:
brew services list brew services stop grafana
https://www.joesandbox.com/#mac creates a report such as this.
NOTE: All options are shown by this command:
lsof -h
See http://www.thegeekstuff.com/2012/08/lsof-command-examples
Drag your Terminal window wider to remove word-wrap.
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME mongod 429 mac 6u IPv4 0xeef754dd0b1f6a1b 0t0 TCP 127.0.0.1:27017 (LISTEN) 2BUA8C4S2C.com. 437 mac 11u IPv4 0xeef754dd0b1f7c0b 0t0 TCP 127.0.0.1:6258 (LISTEN) 2BUA8C4S2C.com. 437 mac 12u IPv6 0xeef754dd02830d03 0t0 TCP [::1]:6258 (LISTEN) 2BUA8C4S2C.com. 437 mac 13u IPv4 0xeef754dd0bcc3313 0t0 TCP 127.0.0.1:6263 (LISTEN) 2BUA8C4S2C.com. 437 mac 14u IPv6 0xeef754dd028307c3 0t0 TCP [::1]:6263 (LISTEN) Resilio\x20Sync 563 mac 7u IPv4 0xeef754dd0d29c313 0t0 TCP *:49387 (LISTEN) Skype 743 mac 20u IPv4 0xeef754dd2d469313 0t0 TCP 10.0.0.2:2301 (LISTEN) SketchMirrorHel 1912 mac 7u IPv4 0xeef754dd12dda63b 0t0 TCP *:56989 (LISTEN) SketchMirrorHel 1912 mac 8u IPv6 0xeef754dd02830283 0t0 TCP *:56989 (LISTEN) SketchMirrorHel 1912 mac 10u IPv4 0xeef754dd11ecaf33 0t0 TCP *:56990 (LISTEN) ruby 13444 mac 7u IPv4 0xeef754dd18739c0b 0t0 TCP 127.0.0.1:4000 (LISTEN) nginx 20244 mac 6u IPv4 0xeef754dd1158563b 0t0 TCP *:8080 (LISTEN) nginx 20245 mac 6u IPv4 0xeef754dd1158563b 0t0 TCP *:8080 (LISTEN) Dropbox 21014 mac 114u IPv6 0xeef754dd05928d03 0t0 TCP *:17500 (LISTEN) Dropbox 21014 mac 115u IPv4 0xeef754dd079ce313 0t0 TCP *:17500 (LISTEN) Dropbox 21014 mac 157u IPv4 0xeef754dd20427a1b 0t0 TCP 127.0.0.1:17600 (LISTEN) Dropbox 21014 mac 163u IPv4 0xeef754dd0e9f763b 0t0 TCP 127.0.0.1:17603 (LISTEN)
“FD” column lists File Descriptors. “u” is for read and write mode. “r” for read only, “w” for write-only.
Linux requires root on operations for well-known ports below 1024.
TCP (Transmission Control Protocol) is the most commonly used protocol on the Internet and any TCP/IP network. TCP enables two hosts to establish a connection and exchange streams of data. TCP guarantees delivery of data and that packets will be delivered in the same order in which they were sent. Guaranteed communication/delivery is the key difference between TCP and UDP on ort 53.
UDP (Datagram Protocol) is connectionless and does not guarantee reliable communication; it’s up to the application that received the message to process any errors and verify correct delivery. UDP is often used with time-sensitive applications, such as audio/video streaming, where dropping some packets is preferable to waiting for delayed data.
NOTE: Drag the scroll bar to see what is beyond what is displayed.
0t0 TCP 127.0.0.1:27017 (LISTEN)
mongod is MongoDB listening on port 27017.
I should keep that closed unless I need it.
https://www.mkyong.com/mongodb/mongodb-allow-remote-access/
In Node, close all connections when the app closes completely:
process.on('SIGINT', function() { mongoose.connection.close(function () { console.log('Mongoose disconnected on app termination'); process.exit(0); }); });
2BUA8C4S2C
When I search for “2BUA8C4S2C” I see “2BUA8C4S2C.com.agilebits” in folder /Users/mac/Library/Group Containers
This says This port is used only on the loopback interface (127.0.0.1) for the 1Password extension to talk to the 1Password Agent. It should be safe to firewall it from any sources other than 127.0.0.1. If you do a packet capture on lo0 and then filter by tcp.port == 6258 you can see what traffic is being passed. Nothing is transmitted in the clear.
Skype I don’t mind keeping open. I use it a lot.
Dropbox - why does it need to be kept open?
I’ll use just their web page when I need it.
See https://www.dropbox.com/help/41
Resilio\x20Sync I used once to get a file.
In Resilio Preferences, uncheck “Start Resilio Sync on startup”.
SketchMirrorHel
XMPP ports 56989 and 56990
Don’t visit http://www.westwind.com/reference/OS-X/background-processes.html
ftp (tftp) should not appear.
Scan other machines
Install
brew install nmap
(Zenmap is the GUI)
There are a lot of options
nmap -h
The format:
nmap [scan type] [options] {target specification}
There are a lot of options
nmap -h
Scan for vulnerabilities using nmap scripts.
nmap -P0 35.87.188.71
Scan for vulnerabilities using vulnerability scanners:
OpenVAS
Scans for versions of applications and operating systems. Compare those against known vulnerabilities and exploits.
Devices on the Internet with open ports are indexed by Shodan.io.
SNR (software defined radios)
Learn basic hardware hacking with UbertoothOne and HackRF One.
US Government has free training at https://ics-cert-training.inl.gov/learn
https://www.wikiwand.com/en/Lsof
https://danielmiessler.com/study/lsof/#gs.3YHJpiA
https://netadmintools.com/html/lsof.man.html
Zeek.org (formerly Bro) and/or snort.org
Network Intrusion detection systems (NIDS)
AlienVault Open Source SIEM (OSSIM) with Open Threat Exchange (OTX) Security Information and Event Management (SIEM) software.
Commercial Honeypot software:
https://learning.oreilly.com/videos/-/9780137446797/ Complete Video Course, 3rd Edition By Omar Santos and Nick Garner from Pearson November 2021
pfSense CE (Community Edition)
https://www.pfsense.org/ from Rubicon Communications, LLC (Netgate) started in 2008 as the Monowall firewall based on BSD operating system.
https://www.pfsense.org/products/ on ARM and Intel Atom hardware
https://www.youtube.com/watch?v=Qr1nUxdzcbA on David Bombal’s channel by Tom Lawrence of lawrencesystems.com <a target=”_blank” href+https://www.youtube.com/watch?v=1E6fYKlQKa0”>VIDEO</a>: vs. Unifi USG/UXG, UDM
https://www.netgate.com/training/pfsense-fundamentals-and-advanced-application To get pfSense Plus Fundamentals certification, first correctly answer 75% of 90 multiple-choice questions in 60 minutes. Then schedule and complete the nine labs of the Practical assignment over two-days with 20 others. On day one, complete labs 1-5 and pause for the instructor to grade your progress. If you pass, continue to lab 6. When complete, the instructor will grade lab 6. A passing grade means you can return the following day to complete labs 7-9.
Proxmox
https://www.youtube.com/watch?v=xmpYfyNmWbw CompTIA Network+ Full Course FREE [23+ Hours]
This is one of a series on Mac OSX: