Skip to content
statance
MenuClose
← All ports

Port 23: Telnet

Critical risk

Port 23 is Telnet, an old remote-login protocol with no encryption. It still appears on routers, switches, embedded devices and some industrial equipment. It should not be reachable from the public internet.

Port
23
Protocol
TCP
Service
Telnet
Expose to internet?
No

Is port 23 safe to open?

Telnet sends the username, password and the whole session in plain text. Internet-facing Telnet is one of the most heavily scanned services, and botnets such as Mirai spread by logging in to devices with default Telnet credentials. There is no safe way to expose it.

How to secure Telnet

  • Disable the Telnet service and use SSH instead.
  • On network equipment, turn off Telnet in the management settings and enable SSH (for example transport input ssh on Cisco IOS lines).
  • Change default device passwords even if Telnet is only reachable internally.
  • Block port 23 at the network edge.

Check if port 23 is open

Linux: what is listening on this port

sudo ss -tlpn | grep ':23 '

Windows (PowerShell): what is listening

Get-NetTCPConnection -LocalPort 23 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}

From another machine: is it reachable

nc -zv HOST 23 # or nmap -p 23 HOST # Windows Test-NetConnection HOST -Port 23

Restrict port 23 in the firewall

Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:23:23) instead of relying on the host firewall.

ufw: allow only your private network, deny everyone else

sudo ufw allow from 10.0.0.0/8 to any port 23 proto tcp sudo ufw deny 23/tcp

firewalld: allow one source network only

sudo firewall-cmd --permanent --remove-port=23/tcp sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="23" protocol="tcp" accept' sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p tcp --dport 23 -s 10.0.0.0/8 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 23 -j DROP

Windows Firewall (PowerShell, as Administrator)

New-NetFirewallRule -DisplayName "Block 23 from internet" -Direction Inbound -Protocol TCP -LocalPort 23 -RemoteAddress Internet -Action Block

Monitor port 23

Run a TCP port monitor against your public IP on port 23: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.

Related ports

Port 22SSHMedium risk
Port 2222SSH (alternate port)Medium risk

FAQ

Why is port 23 open on my router?

Some routers and IoT devices enable Telnet for remote support. Turn it off in the admin interface if you can, and check the vendor has firmware that removes it.

What is port 23 used for?

Port 23 is Telnet, an old remote-login protocol with no encryption. It still appears on routers, switches, embedded devices and some industrial equipment.

Is port 23 TCP or UDP?

Telnet uses TCP on port 23.

How do I check if port 23 is open?

On the server, run sudo ss -tulpn | grep ':23 ' (Linux) or Get-NetTCPConnection -LocalPort 23 (Windows) to see what is listening. From another machine, run nc -zv HOST 23 or Test-NetConnection HOST -Port 23.

All ports →

Know the moment a port stops answering.

TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.