breakfixlearn.com

NET-02Networking

Common ports & protocols

Use this when: you read a firewall rule, scan or netstat output and need the service behind a port.

NET-02 Common ports & protocols cheat sheet. Every table on it is repeated as text below.
Tap the sheet for the full-size image. The text version below is screen-reader friendly.

Text version

Everything on the sheet, as plain HTML: handy for screen readers, copy-paste and search.

Port map: 32 ports to know

Port, protocol and transport. Ports 23, 21/20, 69, 80, 110, 143, 161/162 and 514 send data in cleartext; 22, 443, 587 with TLS, 993, 995, 636, 6514 and 5061 are encrypted.

GroupPortProtocolTransport
Remote and files20/21FTPTCP
22SSHTCP
23TelnetTCP
69TFTPUDP
137 to 139NetBIOSUDP/TCP
445SMB/CIFSTCP
3389RDPTCP/UDP
5900VNCTCP
Web and email80HTTPTCP
443HTTPSTCP/UDP
25SMTPTCP
587Mail submissionTCP
110POP3TCP
995POP3STCP
143IMAPTCP
993IMAPSTCP
Network services53DNSUDP/TCP
67/68DHCPUDP
123NTPUDP
161/162SNMPUDP
514SyslogUDP
6514Syslog over TLSTCP
5060SIPUDP/TCP
5061SIP over TLSTCP
Identity and data88KerberosUDP/TCP
389LDAPTCP/UDP
636LDAPSTCP
49TACACS+TCP
1812/1813RADIUSUDP
1433MS SQLTCP
3306MySQLTCP
5432PostgreSQLTCP

Swap cleartext for secure

Instead ofUseHow it is protected
Telnet 23SSH 22Encrypted
FTP 21, TFTP 69SFTP or SCP on 22Over SSH
HTTP 80HTTPS 443TLS
POP3 110, IMAP 143995, 993Implicit TLS
LDAP 389LDAPS 636TLS, or StartTLS on 389
SNMP v1/v2cSNMPv3Adds authentication and encryption

Port ranges

RangeNameUsed for
0 to 1023Well-knownSystem services
1024 to 49151RegisteredVendor applications
49152 to 65535DynamicClient source ports

TCP is reliable and uses a handshake: web, SSH, mail, SMB. UDP is fast with no handshake: DNS, DHCP, NTP, VoIP. DNS also uses TCP 53 for zone transfers and big replies. Source: RFC 6335.

What is listening on this host?

CommandWhereWhat it answers
netstat -ano | findstr LISTENINGWindowsListening ports and PIDs
Get-NetTCPConnection -State ListenPowerShellListening TCP ports
ss -tulpnLinuxListening TCP and UDP ports
Test-NetConnection 192.0.2.10 -Port 22PowerShellIs the remote port open?
tasklist /FI "PID eq 4321"WindowsWho owns the PID?
lsof -i :443LinuxWho uses 443?

Caution. ss -p and lsof need sudo to see other users' processes. Exit the root shell when done.

Firewall rules of thumb

Danger. Never open these to the internet: 23 Telnet, 135 to 139, 445 SMB, 3389 RDP, 1433, 3306 and 161 SNMP.

  • Default: deny all inbound, allow only what a service needs.
  • Remote access: RDP or SSH through a VPN or gateway with MFA.
  • Verify: a port is a hint, not proof. Check the service.
  • Log: log denied traffic and review it weekly.

Remember

  • FTP: 21 is control, 20 is data (active mode)
  • SNMP: 161 is the manager polling, 162 is traps
  • RADIUS is UDP, TACACS+ is TCP 49
  • DHCP: server 67, client 68, both UDP
  • Mail: 25 server to server, 587 client sends
  • SSH 22 also carries SFTP and SCP

Sources

Go deeper on the blog