What do the IAC bytes before a Telnet login prompt mean?
AdminKit's short answer: the unreadable bytes a Telnet server sends before its login prompt are option negotiation. Each starts with byte 255 (IAC, interpret as command), then WILL, WONT, DO or DONT and an option number such as echo or terminal type. Decoding them identifies the daemon and shows which client data it accepts.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- Every Telnet command starts with byte 255, IAC. Negotiation commands are three bytes: IAC, one of WILL/WONT/DO/DONT, and an option number from the IANA registry.
- The bytes a server sends before
login:are a fingerprint. BusyBox telnetd, for example, always opens with the same twelve bytes. - Options such as terminal type and the environment options carry client data to the server. In January 2026 the USER variable passed this way let anyone log in to GNU InetUtils telnetd as root (CVE-2026-24061).
- Decoding the negotiation helps you identify a device you own. It never makes an exposed Telnet port acceptable; the fix is still to close it.
Why does a Telnet server send bytes before the login prompt?
Telnet is older than most of the devices still running it. RFC 854 describes it as a byte stream between two “network virtual terminals” that start from a minimal shared model of a terminal, then agree on extras such as echoing, window size and terminal type. That agreement happens in-band, inside the same TCP connection that later carries your username and password, so a server that wants a particular behaviour asks for it straight after the connection opens.
To tell commands apart from ordinary text, the protocol reserves one byte value as an escape. RFC 854 calls it the “Interpret as Command” (IAC) character, the decimal value 255, and states that “only the IAC need be doubled to be sent as data”. Any time a receiver sees 255, the next byte is a command, unless it is another 255, in which case the pair means one literal data byte.
A normal Telnet client reads these commands, answers them and shows you nothing. A raw TCP tool such as netcat has no idea what they are, so it prints them as a few garbage characters ahead of the prompt. The AdminKit guide on whether port 23 (Telnet) is exposed shows that output; this page explains how to decode it.
What are the IAC command codes?
RFC 854 defines the command bytes that may follow IAC. Only six of them matter for reading a server’s opening: the four negotiation verbs and the pair that frames a subnegotiation. The rest are rare in practice but show up in captures from older equipment.
| Byte (decimal) | Hex | Name | Meaning |
|---|---|---|---|
| 255 | FF | IAC | Interpret As Command; next byte is a command (or a literal 255 if doubled) |
| 254 | FE | DONT | Asks the other side to stop performing an option, or confirms it should not |
| 253 | FD | DO | Asks the other side to perform an option, or confirms it should |
| 252 | FC | WONT | Refuses to perform an option, or confirms the sender stopped |
| 251 | FB | WILL | Offers to perform an option, or confirms the sender now performs it |
| 250 | FA | SB | Starts a subnegotiation for an option (option data follows) |
| 249 | F9 | GA | Go Ahead, the half-duplex turn signal |
| 246 | F6 | AYT | Are You There |
| 244 | F4 | IP | Interrupt Process |
| 241 | F1 | NOP | No operation |
| 240 | F0 | SE | Ends a subnegotiation |
The direction is the part that confuses people. RFC 854 sums it up: WILL is sent by a party to say it wants to begin performing an option itself, and DO is sent to ask the other party to begin performing it. So a server sending IAC WILL ECHO means “I will echo your keystrokes back to you”, while IAC DO ECHO means “please echo mine back to me”. Each verb has a matching refusal, and each request expects exactly one answer.
RFC 855 adds the rules every option follows: either side may refuse any option, an option is off until both agree, and a party must not answer a request that would leave it in the state it is already in. That last rule exists to stop two implementations from bouncing the same request back and forth forever. RFC 1143 later described a small per-option state machine, the “Q method”, because naive implementations still produced negotiation loops.
Which option numbers show up most often?
The third byte of a negotiation command is an option code. IANA keeps the list in its Telnet Options registry, where each number points to the RFC that defines it. A short subset covers almost everything a modern router, camera or switch sends:
| Option | Hex | Name | Defined in | What the server wants or offers |
|---|---|---|---|---|
| 0 | 00 | Binary Transmission | RFC 856 | Eight-bit clean data instead of the NVT’s ASCII model |
| 1 | 01 | Echo | RFC 857 | Who echoes typed characters back to the screen |
| 3 | 03 | Suppress Go Ahead | RFC 858 | Full-duplex operation without GA turn signals |
| 24 | 18 | Terminal Type | RFC 1091 | The client’s terminal name, for example xterm or vt100 |
| 31 | 1F | Negotiate About Window Size (NAWS) | RFC 1073 | The client’s window width and height |
| 32 | 20 | Terminal Speed | RFC 1079 | The client’s line speed |
| 34 | 22 | Linemode | RFC 1184 | Local line editing on the client |
| 35 | 23 | X Display Location | RFC 1096 | Where to send X11 output |
| 36 | 24 | Environment Option | RFC 1408 | Environment variables (older form) |
| 37 | 25 | Authentication Option | RFC 2941 | An authentication exchange inside Telnet |
| 38 | 26 | Encryption Option | RFC 2946 | Encryption of the Telnet stream |
| 39 | 27 | New Environment Option | RFC 1572 | Environment variables such as USER and DISPLAY |
Echo and Suppress Go Ahead together are the classic way a server says “I will handle echoing, and we are not taking turns”. That pair is what lets a password prompt hide your typing: the server promises to echo, then simply does not echo the password characters.
How do you decode a captured opening, byte by byte?
The safest place to practise is a device you own on your own network. Connect with netcat and pipe the output through a hex viewer so nothing is hidden. The server below is an example; the bytes match the opening sequence in the BusyBox telnetd source, which sends DO ECHO, DO NAWS, WILL ECHO and WILL SGA to every new connection.
$ nc -w 3 192.168.1.1 23 | xxd | head -n 2
00000000: fffd 01ff fd1f fffb 01ff fb03 0d0a 726f ..............ro
00000010: 7574 6572 206c 6f67 696e 3a20 uter login:
Split the stream at every ff and read three bytes at a time:
ff fd 01 IAC DO ECHO server asks the client to echo (client normally refuses)
ff fd 1f IAC DO NAWS server asks for the window size
ff fb 01 IAC WILL ECHO server offers to do the echoing itself
ff fb 03 IAC WILL SGA server offers full-duplex, no Go Ahead
0d 0a ... CR LF then the text "router login: "
A real client would answer with something like IAC WONT ECHO, IAC WILL NAWS followed by a subnegotiation carrying its size, and IAC DO ECHO plus IAC DO SGA to accept the server’s offers. Netcat sends nothing back, which is fine for reading the opening but means some servers wait or close the connection.
Subnegotiations have a different shape: IAC SB <option> <data...> IAC SE. A client’s window-size reply, for instance, is ff fa 1f 00 50 00 18 ff f0, which reads as IAC SB NAWS, width 80 (00 50), height 24 (00 18), IAC SE. When the server wants a value it asks with a subnegotiation of its own, such as IAC SB TERMINAL-TYPE SEND IAC SE, and the client replies with an IS subnegotiation that contains the terminal name as text.
If you prefer a packet capture, Wireshark dissects all of this for you. Its Telnet display filter reference lists fields such as telnet.cmd and telnet.subcmd, so a capture filtered on the Telnet protocol shows each negotiation command by name instead of raw hex.
Why does the opening sequence work as a fingerprint?
A daemon usually sends a fixed list of commands before it has seen anything from the client, so the same software produces the same bytes every time. BusyBox telnetd’s twelve-byte opening above is one example. A full Linux or BSD telnetd tends to ask for more client details up front, such as terminal type, terminal speed, X display location and the environment options, while some embedded vendors write their own minimal servers with a sequence unlike either.
Scanners use exactly this. The Nmap book’s description of its service and version detection technique explains that, after connecting, Nmap first listens for roughly five seconds without sending anything (the “NULL probe”), because many services, Telnet included, identify themselves in an initial banner. Whatever arrives is compared with thousands of signatures, and the negotiation bytes are part of what gets matched.
What the server asks for also tells you what it will accept from the client before anyone has logged in:
| If the server sends | It is asking for | What the client hands over |
|---|---|---|
IAC DO TERMINAL-TYPE (ff fd 18) | The terminal name | A short text string such as XTERM |
IAC DO NAWS (ff fd 1f) | Window size | Two 16-bit numbers |
IAC DO TSPEED (ff fd 20) | Line speed | A text string such as 38400,38400 |
IAC DO XDISPLOC (ff fd 23) | X display location | A host:display string |
IAC DO NEW-ENVIRON (ff fd 27) | Environment variables | Variables such as USER and DISPLAY |
For an owner, that cuts both ways. It is a quick way to work out which firmware a forgotten device on your network is running, but it also means anyone who reaches your port 23 learns the same thing in a few seconds, before they ever see a login prompt.
How did the environment option lead to CVE-2026-24061?
Several options exist so the client can hand information to the server: its terminal type, its display, and with the environment options, variables from the user’s environment. RFC 1572 defines the New Environment Option and a set of well-known variables, starting with USER, which carries the user or account name the client wants to log in as.
On 20 January 2026, GNU InetUtils published an advisory on the oss-security list describing a remote authentication bypass in its telnetd. The server passed the USER value received from the client to /usr/bin/login without sanitising it. A client that sent the value -f root (using the Telnet client’s -a or --login option to transmit USER) was logged in as root, because login -f skips authentication. The advisory lists every version from 1.9.3, released in 2015, up to and including 2.7 as vulnerable and recommends not running telnetd at all.
The issue is tracked as CVE-2026-24061; the Debian security tracker entry summarises it as an authentication bypass in telnetd “through 2.7” and lists fixed inetutils packages for its supported releases. The lesson for anyone reading negotiation bytes is concrete: a server that asks for terminal type, display location or the environment options is choosing to accept client-supplied text before authentication, and every one of those values is input an attacker controls.
Do the authentication and encryption options make Telnet safe?
Telnet does have options for both, number 37 for authentication and 38 for encryption, and seeing a server negotiate them can look reassuring. In practice they were implemented by few clients and devices, and they have their own history. The Nmap script telnet-encryption checks whether a server supports the encryption option, and its description notes that some systems, including FreeBSD and the krb5 telnetd shipped by many Linux distributions, implemented it incorrectly, “leading to a remote root vulnerability”.
So treat any Telnet service as what the base protocol is: plaintext, with credentials typed as ordinary text and nothing proving the server’s identity. If a device supports SSH, use it. The guide on securing an exposed Telnet device covers replacing Telnet, rotating credentials and what to do with equipment that cannot run SSH.
How should you use this when checking your own network?
Reading the negotiation is a diagnostic aid for equipment you own or administer, not a test you run against other people’s addresses. A sensible order:
- Find out whether anything answers on TCP 23 from the internet. AdminKit’s open ports check tests port 23 and eight other commonly exposed device ports on the public IP you are connecting from, and nothing else.
- If something answers, connect from inside your network with netcat and a hex viewer, as above, and decode the opening. A twelve-byte BusyBox-style sequence points to an embedded Linux device such as a router, camera or DVR; a longer request for terminal type and environment variables points to a fuller telnetd, which is where the InetUtils advisory applies.
- Match the device to its documentation and turn Telnet off, or block TCP 23 at the router if the device has no switch for it.
- Re-run the port check from outside to confirm that port 23 now shows as closed or filtered.
If a port number in your firewall logs is unfamiliar, AdminKit’s port number lookup shows what IANA registers it for. Telnet’s assignment, its history and its replacement by SSH are summarised in the Telnet glossary entry.
Where does this fit with other device protocols?
Telnet is one of several protocols covered in AdminKit’s machine protocols cluster that were built for trusted local networks and negotiate features in plaintext before any authentication. The pattern repeats: whatever a device is willing to accept before login is part of its attack surface, so the bytes it sends first are worth a few minutes of decoding on the devices you are responsible for.
Defensive use only
Connect to Telnet services only on devices you own or are explicitly authorised to test. AdminKit’s active checks only ever run against the IP address making the request. See our Disclaimer and Acceptable Use Policy for the full terms.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What does IAC mean in Telnet?
IAC stands for Interpret As Command. It is the byte 255 (hex FF). RFC 854 says every Telnet command is at least two bytes, IAC followed by a command code, and option negotiation commands add a third byte naming the option. A literal data byte 255 has to be sent twice (IAC IAC) so the receiver does not treat it as a command.
What is the difference between WILL and DO?
WILL (251) is an offer or confirmation that the sender itself will perform an option. DO (253) is a request that the other side perform it. The refusals mirror them: WONT (252) means the sender will not perform the option, DONT (254) asks the other side to stop. So 'IAC WILL ECHO' from a server means the server will echo your typing back.
Why do I see strange characters when I connect to port 23 with netcat?
Netcat is a raw TCP tool, not a Telnet client, so it prints the server's negotiation bytes instead of answering them. Values such as FF FD 01 show up as unprintable characters before the login prompt. A real Telnet client reads and answers those commands silently, which is why you never see them there.
Can the option negotiation identify the Telnet server software?
Often, yes. Different daemons open with different fixed sequences. BusyBox telnetd, common on routers and cameras, sends DO ECHO, DO NAWS, WILL ECHO and WILL SGA. Nmap's service detection reads whatever a server sends in its first seconds and compares it with known signatures, and the opening bytes are part of that fingerprint.
Is a Telnet server that negotiates encryption or authentication safe to expose?
No. The Authentication (37) and Encryption (38) options exist, but most clients and devices do not use them, and Nmap's telnet-encryption script notes that some implementations of the encryption option were themselves a remote root vulnerability. Treat any reachable Telnet port as plaintext remote access and move management to SSH on a private network.
Sources
- RFC 854 — Telnet Protocol Specification
- RFC 855 — Telnet Option Specifications
- RFC 1143 — The Q Method of Implementing TELNET Option Negotiation
- RFC 1572 — Telnet Environment Option (NEW-ENVIRON)
- IANA — Telnet Options registry
- oss-security — GNU InetUtils advisory: remote authentication bypass in telnetd (20 Jan 2026)
- Debian security tracker — CVE-2026-24061
- BusyBox source — networking/telnetd.c (initial option negotiation)
- Nmap Network Scanning — Service and version detection technique (NULL probe)
- Nmap NSE — telnet-encryption
- Wireshark — Display Filter Reference: Telnet
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.