Most Common TCP and UDP Ports and Their Services (With Security Notes)
A port is a 16-bit number from 0 to 65535 that tells the operating system which service should receive a TCP or UDP packet. The ports every network and security learner should know are 20 and 21 (FTP), 22 (SSH), 23 (Telnet), 25 (SMTP), 53 (DNS), 80 (HTTP), 123 (NTP), 161 (SNMP), 443 (HTTPS), 445 (SMB), 3306 (MySQL) and 3389 (RDP). IANA keeps the official registry.
Topic: Ethical Hacking in Cybersecurity & Ethical Hacking · Explainer
Also covers: Networking, Network Security
Quick answer: A port is a 16-bit number from 0 to 65535 that tells the operating system which service should receive a TCP or UDP packet. The ports every network and security learner should know are 20 and 21 (FTP), 22 (SSH), 23 (Telnet), 25 (SMTP), 53 (DNS), 80 (HTTP), 123 (NTP), 161 (SNMP), 443 (HTTPS), 445 (SMB), 3306 (MySQL) and 3389 (RDP). IANA keeps the official registry. For each port, learn three things: which service normally uses it, whether it runs over TCP, UDP or both, and what goes wrong when it is exposed or left unencrypted.
Key takeaways
- RFC 6335 splits ports into system (0 to 1023), user (1024 to 49151) and dynamic (49152 to 65535) ranges.
- A port number only suggests a service; anyone can run SSH on 2222, so confirm with service detection.
- Cleartext protocols such as Telnet, FTP and HTTP should be replaced by encrypted versions.
- SMB, RDP and database ports should almost never face the internet directly.
- Close what you do not use; every open port is a service you must patch.
Table of Contents
- What Is a Port and Who Assigns Port Numbers?
- How Do TCP and UDP Ports Differ?
- Which Common Ports Should You Know?
- Which Ports Are Riskiest to Expose?
- How Do You Check Which Ports Are Open on Your Own Systems?
- How Do You Secure Open Ports?
- How Should Students Memorise Ports?
- References
What Is a Port and Who Assigns Port Numbers?
An IP address gets a packet to a host. The port number gets it to the right program on that host. The Internet Assigned Numbers Authority maintains the service name and port number registry, and RFC 6335 defines the three ranges. System ports below 1024 usually need administrator rights to open. Dynamic ports are picked temporarily by clients for outgoing connections.
How Do TCP and UDP Ports Differ?
TCP sets up a connection with a handshake and guarantees ordered delivery. UDP sends datagrams with no handshake, which suits DNS queries, time sync and streaming. TCP port 53 and UDP port 53 are separate sockets, even though both serve DNS. Modern web traffic also uses UDP: HTTP/3 runs over QUIC on UDP 443.
Which Common Ports Should You Know?
| Port | Protocol | Service | Security note |
|---|---|---|---|
| 20, 21 | TCP | FTP data and control | Cleartext logins; use SFTP or FTPS |
| 22 | TCP | SSH, SFTP | Brute-force target; use keys, disable password and root login |
| 23 | TCP | Telnet | Cleartext; disable and use SSH |
| 25 | TCP | SMTP relay | Prevent open relay; clients should submit on 587 or 465 |
| 53 | UDP, TCP | DNS | Block open recursion and unauthorised zone transfers |
| 67, 68 | UDP | DHCP | Rogue servers; enable DHCP snooping on switches |
| 80 | TCP | HTTP | Redirect to HTTPS |
| 110, 995 | TCP | POP3, POP3 over TLS | Allow only the TLS version |
| 123 | UDP | NTP | Abused for amplification; restrict queries |
| 143, 993 | TCP | IMAP, IMAP over TLS | Allow only the TLS version |
| 161, 162 | UDP | SNMP, SNMP traps | Default community strings leak data; use SNMPv3 |
| 389, 636 | TCP | LDAP, LDAPS | Require signing or TLS; keep internal |
| 443 | TCP, UDP | HTTPS, HTTP/3 | Keep TLS configuration current |
| 445 | TCP | SMB | Never expose to the internet; disable SMBv1 |
| 1433 | TCP | Microsoft SQL Server | Keep internal; strong authentication |
| 3306 | TCP | MySQL, MariaDB | Bind to localhost or private network |
| 3389 | TCP, UDP | RDP | Put behind VPN or gateway with MFA |
| 5432 | TCP | PostgreSQL | Keep internal; restrict in pg_hba.conf |
| 5900 | TCP | VNC | Weak or no passwords are common; tunnel it |
| 6379 | TCP | Redis | Enable authentication and bind to localhost |
Which Ports Are Riskiest to Expose?
Remote access and file sharing ports attract the most attention because they hand an attacker a login prompt or a file system. MITRE ATT&CK records adversaries using RDP to move between systems once they have valid credentials, and scanning for exposed services is a standard discovery step (T1046). Microsoft advises blocking inbound SMB at the network edge in its guidance on securing SMB traffic. Databases, Redis and VNC installed with defaults on cloud servers cause similar problems.
How Do You Check Which Ports Are Open on Your Own Systems?
Start from the host itself. These commands list listening sockets on machines you administer:
# Linux: listening TCP and UDP sockets with owning process
sudo ss -tulpn
# Windows PowerShell: listening TCP ports and process IDs
Get-NetTCPConnection -State Listen | Sort-Object LocalPort
# Windows: UDP endpoints
Get-NetUDPEndpoint | Sort-Object LocalPort
Then confirm the outside view with an authorised external scan, because a firewall may block what the host listens on, or a forgotten NAT rule may expose it. Scanning networks you do not own or have written permission to test can be an offence under Sections 43 and 66 of India's IT Act 2000.
How Do You Secure Open Ports?
- Inventory every listening service and remove what is not needed.
- Use a default-deny firewall and allow only required ports from required sources.
- Replace cleartext protocols with encrypted ones.
- Put admin services such as SSH and RDP behind a VPN or bastion with MFA.
- Patch exposed services first and log connection attempts.
How Should Students Memorise Ports?
Group ports by job: remote access (22, 23, 3389, 5900), web (80, 443), mail (25, 110, 143, 465, 587, 993, 995), name and time services (53, 123), file sharing (21, 445) and databases (1433, 3306, 5432). Read our complete list of computer ports for a wider reference, and revise the difference between TCP and UDP. WebAsha runs networking and ethical hacking training with hands-on labs.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0