Telnet
Telnet gives a remote text terminal over TCP, with every keystroke and password in clear text. Replaced by SSH decades ago, it lives on in network devices, embedded systems and IoT, which is why botnets still scan for it.
- OSI layer
- 7 Application
- Carried in
- TCP
- Ports
- 23/tcp, 2323/tcp (common on IoT), 992/tcp (Telnet over TLS, rare)
- Wireshark filter
telnet- Encrypted
- no
Packet structure
Telnet has no header. The TCP payload is the terminal data itself (what you type, what the server prints), with commands mixed in. A command starts with the byte 0xFF (IAC, “Interpret As Command”):
Server → Client: FF FD 18 IAC DO TERMINAL-TYPE "please tell me your terminal type"
Client → Server: FF FB 18 IAC WILL TERMINAL-TYPE "I will"
Server → Client: FF FA 18 01 FF F0 IAC SB TERMINAL-TYPE SEND IAC SE
Client → Server: FF FA 18 00 "xterm" FF F0 IAC SB TERMINAL-TYPE IS "xterm" IAC SE
Server → Client: FF FB 01 IAC WILL ECHO server echoes what you type
Server → Client: "login: "
Client → Server: "r" "o" "o" "t" "\r\n" often one TCP segment per keystroke
Server → Client: "Password: "
Client → Server: "t" "o" "o" "r" "\r\n" not echoed on screen, but in clear text on the wire
| Byte | Command | Meaning |
|---|---|---|
0xFF (255) | IAC | Next byte is a command (FF FF = a literal 0xFF data byte) |
0xFB / 0xFC | WILL / WON’T | Sender offers / refuses to use an option |
0xFD / 0xFE | DO / DON’T | Sender asks / tells the other side not to use an option |
0xFA … 0xF0 | SB … SE | Sub-negotiation: option parameters |
0xF4 | IP | Interrupt process (Ctrl+C) |
0xF3 | BRK | Break |
| Option | Code | Use |
|---|---|---|
| ECHO | 1 | Who echoes typed characters |
| SUPPRESS-GO-AHEAD | 3 | Full-duplex mode (always on today) |
| TERMINAL-TYPE | 24 | xterm, vt100, ANSI |
| NAWS | 31 | Window size |
| TERMINAL-SPEED | 32 | Line speed |
| NEW-ENVIRON | 39 | Environment variables (USER, …) |
How it works
sequenceDiagram
participant C as Client
participant S as Server :23
C->>S: TCP handshake
S->>C: IAC DO / WILL option negotiation
C->>S: IAC WILL / DO replies
S->>C: Banner and "login:" prompt
C->>S: User name, password (clear text)
S->>C: Shell prompt
C->>S: Commands, one keystroke per segment
S->>C: Output
After the TCP handshake both sides negotiate options, then the server’s login program asks for a user name and password, and the session becomes a plain remote shell. There is no encryption and no server authentication.
In Wireshark
| Filter | Shows |
|---|---|
telnet | All Telnet |
telnet.data | Terminal data (add as a column) |
telnet.cmd | Option negotiation commands |
telnet.data contains "login" | Login prompts |
tcp.port in {23, 2323} && tcp.flags.syn == 1 && tcp.flags.ack == 0 | Connection attempts (scanning) |
Follow › TCP Stream shows the whole session as text, including the password (typed characters appear doubled when the server echoes them).
What normal looks like: ideally nothing. On legacy networks, a few admin stations to switches, routers, printers and industrial devices. Telnet from the internet, from a workstation to many hosts, or to 2323 is scanning or botnet activity.
Security notes
- Clear text everything: user names, passwords, commands and output can be read from any capture. One capture on a span port is enough to collect device admin passwords.
- Default credentials: IoT and embedded devices ship with Telnet enabled and passwords like
root:xc3511oradmin:admin. Mirai (2016) and its descendants built huge botnets by trying about 60 default pairs on 23 and 2323. - Session hijacking: with no integrity protection, an on-path attacker can inject commands into a running session.
- Server bugs: old telnetd implementations have had serious remote bugs (e.g. CVE-2020-10188 in netkit telnetd, CVE-2011-4862 in BSD telnetd encryption). Cisco’s CVE-2017-3881 allowed code execution via Telnet on switches.
- Fix: disable Telnet and use SSH. Where a device only speaks Telnet, isolate it in a management network and reach it through a jump host.
- Telnet as a client tool:
telnet host portis still used to test TCP services by hand; this is fine and is not Telnet protocol traffic on port 23.
Versions and related
- RFC 854 (1983) defines Telnet; options are in separate RFCs. Telnet over TLS (port 992) and Kerberos-authenticated Telnet exist but are rarely seen.
- rlogin / rsh (513, 514/tcp) are similar legacy Unix tools, with even weaker host-based trust.
- SSH replaced Telnet; serial console servers often bridge to devices over Telnet on high ports (2001+).
- FTP’s control channel uses Telnet’s line conventions.
References
- RFC 854: Telnet protocol specification
- RFC 855: Telnet option specifications
- IANA: Telnet options
- Mirai botnet analysis (USENIX Security 2017)