networking, updated

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)
Specs
RFC 854, RFC 855, RFC 1091, RFC 1073
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
ByteCommandMeaning
0xFF (255)IACNext byte is a command (FF FF = a literal 0xFF data byte)
0xFB / 0xFCWILL / WON’TSender offers / refuses to use an option
0xFD / 0xFEDO / DON’TSender asks / tells the other side not to use an option
0xFA … 0xF0SB … SESub-negotiation: option parameters
0xF4IPInterrupt process (Ctrl+C)
0xF3BRKBreak
OptionCodeUse
ECHO1Who echoes typed characters
SUPPRESS-GO-AHEAD3Full-duplex mode (always on today)
TERMINAL-TYPE24xterm, vt100, ANSI
NAWS31Window size
TERMINAL-SPEED32Line speed
NEW-ENVIRON39Environment 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

FilterShows
telnetAll Telnet
telnet.dataTerminal data (add as a column)
telnet.cmdOption negotiation commands
telnet.data contains "login"Login prompts
tcp.port in {23, 2323} && tcp.flags.syn == 1 && tcp.flags.ack == 0Connection 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

References

§ home
~/knubertus/home/
1,1 Top